Skip to content

jroelofs/calc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published