[antlr-interest] Parser rule parameters makes C output crash

Waldemar Sauer waldemarsauer at hotmail.com
Sun Jul 22 13:38:20 PDT 2007


I sent this to the antlr mailing list yesterday, but it did not seem to
arrive onto any of the mailing lists, so I'm sorry if this is a repeat
posting.

 

I have a parser problem that I hope someone can give me some help with.  The
parser rule is as follows:

 

varType [Gpi_Var* v, Gpi_Modifiers* mods]: varType0[v, mods]
(refPtrSpecifiers[v])? (varArraySpecifiers[v])?;

 

The problem that I have is that when I create C output, the portion that
parsers refPtrSpecifiers seems to be put into a syntactic predicate
function; "static void synpred14_fragment(pzcppParser ctx)" in my case.  The
problem is that the parameters v and mods for varType are not passed to this
function.  So antlr compiles the grammar just fine, but when I try to
compile the generated C file, "v" is not defined for the function call to
refPtrSpecifiers.  Rewriting the rule as "... (refPtrSpecifiers[v] | ) .."
produces the same result.  Am I doing this wrong?  If not, is there a
temporary workaround for this (hopefully one that does not involve global
variables)?

 

 - Waldemar

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070722/85b2f4a4/attachment.html 


More information about the antlr-interest mailing list