AST generation using YACC

sarwarraza@my-deja.com
1 Apr 2000 14:18:02 -0500

          From comp.compilers

Related articles
AST generation using YACC sarwarraza@my-deja.com (2000-04-01)
| List of all articles for this month |

From: sarwarraza@my-deja.com
Newsgroups: comp.compilers
Date: 1 Apr 2000 14:18:02 -0500
Organization: Compilers Central
Keywords: parse, comment

Hello all..


I am working on a project for a compiler design class. So far, I have
implemented successfully the lexical analyzer and parser for a subset of
ISO standard Pascal. At present, I am outputting a parse tree
'representation' if you may, to verify that the parser is working as it
should. The next step involves the creation of an abstract syntax tree.
I'm using C++, and hope to be able to reuse, at least partially some of
my existing Binary tree classes from previous projects for the actual
tree itself. But I am unfamiliar with how to interface these with yacc.
And how to use Yacc in the AST construction in the first place. I cannot
find any references, in print or on the web for this sort of thing. Can
anyone point me to a good web reference/examples of AST construction
using yacc (no AST generation tools, please), or perhaps provide me with
a high level idea of what the action code in my yacc parser should look
like to get me started on the AST construction.


Thanks
Sarwar
[The AST is for most purposes the parse tree without the boring parts.
Adjust your parser so that rules like '(' exp ')' pass through their
subtree rather than generating a new one. -John]


Post a followup to this message

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