[antlr-interest] Does anyone have a CPP grammer that has AST built into it?

pandeyrajiv pandeyrajiv at yahoo.com
Mon Nov 10 14:08:22 PST 2003


Hi All,

I am very new to ANTLR and am trying to use it for a project where we
wish to parse Java and C++ files and do some decision making based on
the result of the parsing.

I started out with the Java grammer and everything was peachy as I
could persist the AST as an XML file and do some scanning on that file
to do post processing.

HOWEVER, when I tried the C++ grammer, it does NOT seem to have any
AST related pieces in the grammer and so when I try to do the
following call to serialize the output:
FileWriter writer = new FileWriter("c:/temp/antlr.xml");
((BaseAST)parser.getAST()).xmlSerialize(writer);

I get a Null pointer exception since there *is* no AST tree that got
built...

Can anyone help!!!

I am very new to this and do not have the expertise to be able to
modify the grammer to build the AST...I am sure someone out there has
done this before...

Thanks so much

Rajiv Pandey
pandeyrajiv at yahoo.com


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list