[antlr-interest] Errors in code generated by the ANTLR C target

Jim Idle jimi at temporal-wave.com
Mon Jun 4 13:49:39 PDT 2007


Hmm - something does not sound quite right here. Can you get the
examples running (specifically, in this case the Java parser example?).

However, it could be that I am missing some definitions out of the Tree
output if you are using backtracking and memoizing (which, incidentally
you should only ever do for a development version of your grammar).

Can you send me you grammar?

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of troy runkel
> Sent: Monday, June 04, 2007 1:45 PM
> To: ANTLR mail-list
> Subject: [antlr-interest] Errors in code generated by the ANTLR C
> target
> 
> Greetings,
> 
> I'm using version (ANTLR Parser Generator  Version 3.0 (May 17, 2007)
> 1989-2007) of ANTLR and the grammar I'm working on has the following
> options set.
> 
>     language    = C;
>     output        = AST;
>     backtrack   = true;
>     memoize    = true;
> 
> I'm seeing a number of errors in the generated C code when I try to
> compile in using Visual Studio 2005.
> 
> 1) The REWINDLAST macro expands to
> INPUT->istream->REWINDLAST(INPUT->istream), but REWINDLAST doesn't
> exist in ANTLR3_INT_STREAM_struct.  I'm assuming it's supposed to
> expand to INPUT->istream->rewindLast(INPUT->istream).
> 
> 2) The SEEK macro appears in the generated code but is not defined.
> However I was able to find a definition for SEEK in the
> antlr-3.0\src\org\antlr\codegen\templates\C\C.stg file.
> 
> I'm also working on a tree grammar and am seeing similar errors in the
> generated C code for that as well.
> 
> 1) I'm seeing the same REWINDLAST and SEEK macro errors mentioned
> above.
> 
> 2) The INDEX macro appears in the generated code but is not defined.
> 
> 3) The MEMOIZE macro is also used but not defined.
> 
> What am I doing wrong here?  I believe I'm working with the "official"
> ANTLR v3 release, but the generated C code won't compile.
> 
> Thanks.
> 
> Troy Runkel


More information about the antlr-interest mailing list