Cc618 / Tiny-Calculator

A small calculator made with Flex, Bison and GCC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

A small calculator made with Flex, Bison and GCC

License:MIT License


Languages

Language:Yacc 51.7%Language:Lex 23.7%Language:C 12.9%Language:Makefile 11.7%