Simple toy calcualtor that parses a command-line provided string, and evaluates the resulting expression.
git clone [email protected]:jroelofs/calc.git
mkdir build && cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ../calc
ninja
crepl
can either be used with and expression as the command-line argument:
$ ./bin/crepl "1 + 1"
2
$ ./bin/crepl "1 + 2 * 3"
7
or with pipes:
$ echo "2*(1+2)" | ./bin/crepl -
6
or as a Read-Evaluate-Print-Loop, or REPL:
$ ./bin/crepl
> 1+2
3
> 3*4
12
> q
$ ninja check