[antlr-interest] c++ interpreter with antlr ??

oliver_kowalke oliver_kowalke at yahoo.de
Wed Apr 28 02:23:10 PDT 2004


hello,

i'm new to antlr and topics like compiler development.
my simple application (written in c++) parses c++ syntax (used the c++
grammar provided by David Wigg).
i've no glue how to get my app to interpret the parsed syntax. some
projects already interpret c++ but i want to learn the neccessary steps.
maybe you can post me a link to a tutorial or so?
thanks for your help.
oliver

--- the simple code ---

antlr::ASTFactory factory;

std::stringstream ss;
ss << "int f() { return 3+2; }";

CPPLexer lexer( ss);

CPPParser parser( lexer);
parser.initializeASTFactory( factory);
parser.setASTFactory( & factory);
parser.init();
parser.translation_unit();

antlr::RefAST ast = parser.getAST();
std::cout << "as string list: " << ast->toStringList() << std::endl;
std::cout << "as string tree: " << ast->toStringTree() << std::endl;




 
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