Project done for Compiler in ShanghaiTech, which is also the project in Stanford.
cool_examples/ conatins all the codes I found from Github. It's not my work. You may check
the README.md inside that folder to find the writer(https://github.com/shinezyy/).
A lexer written for COOL. Flex used.
There are potential bugs, see README inside.
A parser written for COOL. bison used.
Do notice that PA2 is a little bit different from that in Stanford.
My cool.y couldn't correctly print all the error log, but the parser functions as long as the program is correct.
A semantic analysis written for COOL.
Code generator.
This file is compiled under 32bit machine, you need to install the libc support before you can run it on 64bit machine:
sudo apt-get install libc6-i386 lib32stdc++6