File tree Expand file tree Collapse file tree 1 file changed +46
-2
lines changed Expand file tree Collapse file tree 1 file changed +46
-2
lines changed Original file line number Diff line number Diff line change 1
- Jut some simple lexical analysis and building an Abstract Syntax Tree to evaluate simple mathematical expresssions
1
+ # Calculator
2
2
3
- Currently handles PEMDAS, functions, and understanding parentheses back to back as multiplication
3
+ This was done for my CS 480 class.
4
+
5
+ This does simple lexical analysis and building an Abstract Syntax Tree to evaluate simple mathematical expresssions
6
+
7
+ It currently handles PEMDAS, functions, and understanding parentheses back to back as multiplication
8
+
9
+ ## Requirements
10
+
11
+ This requires [ NodeJS] ( https://nodejs.org/en/ ) and npm.
12
+
13
+ ## Installing
14
+
15
+ Clone the repository.
16
+
17
+ ``` bash
18
+ npm install
19
+ ```
20
+
21
+ ## Building
22
+
23
+ ``` bash
24
+ npm run build
25
+ ```
26
+
27
+ This will build the typescript code into executable NodeJS.
28
+
29
+ ## Usage
30
+
31
+ Once built, you can run it with:
32
+
33
+ ``` bash
34
+ ./bin/calc < expression>
35
+ ```
36
+
37
+ The entire expression must be the first argument so if you want to add spaces, you must use quotes.
38
+
39
+ Parantheses and other special characters confuse the shell so you will need to escape them with ` \ ` or use quotes.
40
+
41
+ ## Tests
42
+
43
+ Test can be ran with:
44
+
45
+ ``` bash
46
+ npm run test
47
+ ```
You can’t perform that action at this time.
0 commit comments