[antlr-interest] Question about example Ansi C grammar for antlr v3
Fredrik Ohrstrom
oehrstroem at gmail.com
Wed Jun 17 07:19:28 PDT 2009
Sadly enough ;-) , the following c-code compiles both using gcc and cl.exe
---------------
typedef int alfa;
typedef int beta;
struct { struct { int z; } alfa; } c;
int main(int alfa)
{
beta beta;
}
---------------
The example antlv3 c-parser found on the antlr homepage will wrongly
parse the alfa inside the struct as a type_id and not a direct_declarator.
In the same way it wrongly parses the argument alfa and the function local beta.
I have tried to extend the grammar to fix this, unfortunately I have not
been able to solve all the cases in the example, only the arg and
local var case.
What is the correct way of solving this?
//Fredrik
More information about the antlr-interest
mailing list