Replies: 1 comment
-
I learned some of C++grammar. Now I understand that it is due to its grammar's ambiguity. it is not possible to solve without semantic analysis. I will close this Q&A. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm working on creating a tool on ANTLR with CPP14Parser.g4 grammar. However, as I mentioned in the title, it parses a body-statement after the condition in an if-statement as a 'simpleDeclaration'.
Here is an example of that.
void func(int a) { if(a == 0) print(a); }
In this simple example, the parser ends up with interpreting
print(a);
as a simpleDeclaration.I think it is supposed to be a 'postfixExpression'.
I would like to know whether it is some kind of problem or intentionally being like this?
Could anyone give me some help?
Beta Was this translation helpful? Give feedback.
All reactions