This is a simple C compiler that created with lex
and yacc
and it is my compiler design course project :)
In archlinux simply install byacc
and use it for creating y.tab.c
and lex
for creating y.lex.c
.
I think that fairly simple packages are needed for this porject. It would be just byacc
and bison
and lex
.
sudo pacman -S byacc
sudo apt-get install byacc lex
yacc
is the fundamental parts of a compiler. Parsers are integrated in .yacc
file and there is no optimization for it. However, we have a simple semantic analyzer available to be used here. I try to generate llvm
assembly in order to use llvm's code optimizer and other benefits of it.
you can do it by using assembler.py
. You need to just give three address code which is generated by compiler to python the script as first argument python2 assmebler.py threeaddresscode.txt
.
Follow the mybash.sh
script so that you can figure out how this project is working.