Decide how to treat statement with no effect
Closed this issue · 1 comments
herrBez commented
We should decide where and how to treat statement with no effect.
If we parse them and then simply ignore them during the syntactic analysis, we encounter problems in the if and while TAC generation, because we assume that the body of the statements and especially of the if is not NULL.
I have two solution' proposals:
- Avoid sintactically the statement --> stmt expr SEPARATOR. The advantage of this solution is that it does not affect the rest of the program.
- Solve them during TYPE-checking so that we can accept this kind of statement and then remove dead code. Advantage: gcc like and more powerful - Disadvantage we have to modify (massively??) the type checker to control if the bodies of if and while are not empty
StefanoMunari commented
I vote for the simpler/faster one, so 1.