Name | Description | Status |
---|---|---|
Master | Compiler Assignment | Working |
Glamdring | Galmdring Implementation | Working |
Main Compiler Assignment Working Glamdring Glamdring Implementation In Progress
Flex Bison LLVM 3.8
A more detailed report, explaining how the code works can be found here: Report
make (See the IR code for demo code test.c) make test (To run the demo code test.c using lli)
To get started tutorial at: https://gnuu.org/2009/09/18/writing-your-own-toy-compiler/ was followed. Some of the initial code was taken from this to get things started.
There are many differences and construct implemented for the assignment which is not present in the tutorial.
- Tutorial uses its own simplified version of token and lex files
- I have used the token and the grammar provied for the assignment which is much more complex and differs completely from that given in tutorial.
- Function declaration
- Extern keyword
- const keyword
- Pointer
- Ellipsis
- Variable types: int double char
- long is partially supported and not all operations are valid on it.
- pointers for calling the printf function.
These where required so that printf declaration: extern int printf(char const *format, ...); works
- Arithmetic operatios + - * /
- Unary operator _++ -- (with left and right placement)
- Comparison operators <= == != < > >=
- Assignment operator += -= *= = |= &=
- If then else statment. Even if else is missing
- While loop
- Do while loop
- For loop, (all the constructs mentioned in the grammar)
- Global variables
- Const keyword.
- Function Definition and Function Declarations
are supported.