Components of a compiler for a simplified C family language
Convert MIPS language to its binary representation
Tokenize CLike program into pieces of tokens
Reads an LR1 File representing a context-free grammar, an LR(1) machine, and a sequence to be recognized. If the sequence is in the language, output unindented reversed rightmost derivation format
The semantic analysis phase of the CLike compiler. In particular that catches all remaining compile-time errors in the source program; a program that makes it through this program of compilation is guaranteed to be free of compile-time errors
Generates corresponding MIPS code of a CLIKE program
There is a CLike program named foo.CLike
that can be used to try out the compiler, first run:
cat foo.CLike | ./scan | ./parse | ./errorCheck
to check if there is any error, if the program prints nothing, then there is no error and we can compile the program by entering:
cat foo.CLike | ./scan | ./parse | ./codeGen
There is a MIPS program named treeHeight.asm
that can be used to try out the assembler, run:
./assemble < treeHeight.asm > treeHeight.mips
, then treeHeight.mips
is a executable MIPS program