Micro calculator implementation to explain a software development fundamentals.
Pass the expression in a Reverse Polish Notation form as the command line
arguments. The result of calculation echo'ed back to stdout.
For example:
$ ucalc + 1 - 2 \* 3 / 4 5
0.6
Use C/C++ compiler to build the command.
clang -c src/ucalc.c
clang -c src/parser.cc -std=c++14
clang -o ucalc -lc++ *.o
Or you can use make
to build:
make -C src
Note that make
generates the command under the src directory.