Skip to content

Latest commit

 

History

History
49 lines (38 loc) · 835 Bytes

README.md

File metadata and controls

49 lines (38 loc) · 835 Bytes

Build Status Coverage Status

Toy Calculator

Simple toy calcualtor that parses a command-line provided string, and evaluates the resulting expression.

Build

git clone [email protected]:jroelofs/calc.git
mkdir build && cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ../calc
ninja

Run

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

Test

$ ninja check