Tiny-Calculator
A small calculator made with Flex, Bison and GCC
Example
Here is a small example of the program :
3 * 2 - 8
Result: -2.000000
2*3/8-9
Result: -8.250000
exit
You can notice that the whitespaces are ignored. Type exit to quit.
Features
- Operator priorities (compute * before +)
- Space handler (you can add whitespaces or tabs in the calculation)
How to use ?
To build this program you must have Flex, Bison and GCC. You can also use make.
In the src directory, type :
make
Or if you want to build step by step :
flex lexer.l
bison -d parser.y
gcc -o tiny_calculator main.c lex.yy.c parser.tab.c
The name of the program is "tiny_calculator".
If the target platform is not Linux, make sure to add an extension to the name.