Project made on october 2020
Table of Contents
This is a program named evalexpr.
This project shows how the evaluation of an arithmetic expression works by handling precedence, variables, and functions.
The following open source packages are used in this project:
- Stack vers.2.13
code
.
├── app
│ └── Main.hs
├── funEvalExpr.cabal
├── Makefile
├── package.yaml
├── src
│ ├── Calculator.hs
│ ├── Check.hs
│ └── Lib.hs
├── stack.yaml
├── stack.yaml.lock
└── unitTest
└── unit_test.bats
Support:
- + (plus)
- - (sub)
- * (multiplication)
- / (division)
- ^ (exponential)
works with () - parenthesis
Compile the makefile (make) and add some arithmetic expression like this !
$> ./funEvalExpr "6 * 12 / 2 * (1 - 2 - (2 - 4 - 5) - 10) ^ 2 * (2 - 7 - 4) ^ 3" $> -419904.00
> make && test_runOr Put the executable in the `unitTest` folder and run like this :
> bats unit_test.bats
Evalexpr | Test |
---|---|
error management | 100% |
one single unary operator | 100% |
parenthesis | 100% |
Mixed binary operators | 100% |
All mixed | 100% |
Coding style | 66.7% |
👦 Edouard Touch
Email: [email protected]
GitHub: @eydou