Simple C program that evaluates math expressions.
This was written over Thanksgiving Break 2023, so it's not the best :)
- Addition
- Subtraction
- Multiplication
- Implicit multiplication is also supported, but doesn't have higher precedence.
- Division
- Exponentiation
- Parentheses
-
Built-in functions
-
sin, csc
-
cos, sec
-
tan, cot
-
sinh, csch
-
cosh, sech
-
tanh, coth
-
arcsin, arccsc
-
arccos, arcsec
-
arctan, arccot
-
log (log 10)
-
log_n
-
factorial
-
pi
-
e
-
-
Variables
- run
make
, ormake debug
for debugging purposes. - run the executable via
./math_eval
.
- CS429 CI Lab for some ideas on how to set up the AST
- https://github.com/tlaceby/guide-to-interpreters-series