Skip to content

Latest commit

 

History

History

calcc

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

A simple calculator (compiler version)

calcc - a simple calculator (compiler version) - is a sample application using CPARSEC2 library

calcc parses an integer arithmetic expression, and generates x86_64 assembly code. (i.e. compiles an integer arithmetic expression)

How to build

make

Usage

Usage
calcc <expression>
$ ./bin/calcc '10 + 2 * 3' > tmp.s
$ gcc -o tmp tmp.s
$ ./tmp
$ echo $?
16

$ ./bin/calcc '(10 + 2) * 3' > tmp.s
$ gcc -o tmp tmp.s
$ ./tmp
$ echo $?
36