[antlr-interest] Parser question: producing an AST tree?
Vince Marco
vmarco at mac.com
Wed Oct 23 08:58:52 PDT 2002
Here's a newbie parser question. I'm trying to produce a hierarchical
AST tree from a C++ source file. My lexer works over the 400K codebase,
but when I walk the AST I get all the tokens as siblings...ie. a flat
tree. Here is my parser line for a method:
cppmethod
: (ID^ COLON COLON (TILDE)? ID^ LPAREN (param (COMMA
param)*)? RPAREN cppbody)
;
I thought that by putting in the carot "^" the remaining tokens would be
added as children to the first ID. My objective was to get the AST tree
nested as desired before generating a Walker. Is this a faulty
approach? All my tokens in the entire file are still siblings (ie. no
children). Any suggestions for what I'm doing wrong?
Vince
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list