gradual-verification / gvc0

Gradually Verified C0
6 stars 5 forks source link

Parse error for while(true); #2

Open conradz opened 3 years ago

conradz commented 3 years ago

Since a ; is not an empty statement in C0, the parser should error on while(true);. Currently it parses this as a method invocation. while is a reserved word, so it can never be a method name. See the fp-basic/semi.c0 test case.

cliu369 commented 5 months ago

This issue is likely caused by the parser not distinguishing reserved words from identifiers, e.g., the parser would also not error on if(true);.

Additionally, it is possible to parse code that uses reserved words as a method or variable name when running with the -d flag(void while(bool b) { } or int if = 1;).