I added Semantic Analysis to my C compiler. The pass has variable resolution and loop labeling.
In variable resolution the compiler resolves each variable with unique identifiers where needed.
In Loop Labeling each break or continue statement is labeled with its corresponding loop. so we can generate TAC code to the end of the loop.
It also checks for errors in invalid lvalues, non declared variables and doubly defined variables.
It works after the parser but before the TAC Generator.
The compiler supports for Loops, while Loops, Ifs and Conditional Expressions:
If you want to look at the code:
No comments:
Post a Comment