[antlr-interest] [antlr3c] Posible bug i C runtime generated code (ANTLR v3.1.3 and libantlr3c 3.1.3)

Gavin Lambert antlr at mirality.co.nz
Mon Aug 3 04:18:59 PDT 2009


At 20:38 3/08/2009, Adamic Tomislav wrote:
 >Using two grammars below, ANTLR generates code that is not
 >compilable with either C or C++ compiler. Specifically,
 >generated file "ExampleGrammarEval.c" contains expression
 >"MyStruct value = NULL;" which is not valid C/C++ (because
 >value is not pointer) so the code doesn't compile.
[...]
 >prog returns [MyStruct value]
 >    : expr { $value = $expr.value; };

These constructs are currently not legal in the C 
target.  Parameters and return values must either be primitive 
types or pointers.



More information about the antlr-interest mailing list