This is a compiler for a small part of the C language. I'm trying to get it to compile to very simple intermediate language, while adding small features step by step, then when I have enough features
... [More]
I'll make the real assembly generation. (Instead of aiming too high and having a perfect parser and say, no code generation)
Update: June 16, 2009During the past days I've been heavily working on the IML generation. I've implemented a conservative register allocation algorithm. The IML generation is very limited though. Still do not have any generation to call functions. Notice that the IML is still fairly high level ( accessing local variables by name rather than stack offset ).
Input:int main(int testParameter) {
int a = 3;
int b = 4;
int c = a + b;
}Output:Globals:
Text:
main:
push ebp
mov esp, ebp
sub 12, esp
mov 3, r0
mov 4, r1
mov r1, b
add r0, r1
mov r0, a
mov r1, c
mov ebp, esp
pop ebp
ret [Less]