[antlr-interest] Re: C++ Segmentation Fault
lgcraymer
lgc at mail1.jpl.nasa.gov
Thu Jun 10 15:08:20 PDT 2004
This one's pretty common--you need to initialize the AST Factory.
Look at the ANTLR manual under "Using Heterogeneous AST types" in the
"C++ notes".
--Loring
--- In antlr-interest at yahoogroups.com, "Marx Gomes" <ceticobr at y...> wrote:
> Hello,
>
> I'm starting to use ANTLR to generate C++ output. I've designed a
> simple grammar, and everything seems to work well, except that I can't
> set "buildAST = true" without getting "Segmentation fault" errors
> whenever I run my parser. Neither ANTLR nor the C++ compiler complain
> about anything in the source files, it compiles nicely, just does not
> work (unless I comment out the "buildAST = true" line, then it runs
> perfectly).
>
> I was able to trace the problem back to this line:
>
> RefAST t = nodeFactories[tok->getType()]->second();
>
> inside method "RefAST ASTFactory::create(RefToken tok)"
> in file "AstFactory.cpp"
>
> Looks like the problem occurs because an invalid index
> ("tok->getType()") is acessed in "nodeFactories", but that's all I can
> say about it, since I'm not very much familiar with the generated
> code.
>
> Anybody knows where the problem could be? I could post parts of my
> grammar, if it helps.
>
> Thanks in advance,
> Marx
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list