Pointers for AST documents

the_hitler@hotmail.com (jack)
6 May 2003 19:20:22 -0400

          From comp.compilers

Related articles
Pointers for AST documents the_hitler@hotmail.com (2003-05-06)
| List of all articles for this month |

From: the_hitler@hotmail.com (jack)
Newsgroups: comp.compilers
Date: 6 May 2003 19:20:22 -0400
Organization: http://groups.google.com/
Keywords: parse, AST, question
Posted-Date: 06 May 2003 19:20:21 EDT

Hi,
Could anyone please provide me sites for good documents on "how to
build AST from lex/yacc"?


Thanks in advance,
bob
[There's no great secret, you build subtrees in each rule, passing them
up as you go. In the rules that aren't semantically interesting, don't
build any nodes, e.g.:




expr: expr '+' expr { $$ = build_node(PLUS, $1, $3); } /* interesting */
expr: '(' expr ')' { $$ = $2; } /* not interesting */


-John]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.