Building a parse tree that reflects C Semantics

"VBDis" <vbdis@aol.com>
13 Oct 2002 16:05:26 -0400

          From comp.compilers

Related articles
Building a parse tree that reflects C Semantics vbdis@aol.com (VBDis) (2002-10-13)
Re: Building a parse tree that reflects C Semantics grosch@cocolab.de (Josef Grosch) (2002-10-18)
Re: Building a parse tree that reflects C Semantics idbaxter@semdesigns.com (Ira Baxter) (2002-10-20)
Re: Building a parse tree that reflects C Semantics whopkins@alpha2.csd.uwm.edu (Mark) (2002-10-20)
Re: Building a parse tree that reflects C Semantics rbates@southwind.net (Rodney M. Bates) (2002-10-20)
Re: Building a parse tree that reflects C Semantics david.thompson1@worldnet.att.net (David Thompson) (2002-10-25)
Re: Building a parse tree that reflects C Semantics rbates@southwind.net (Rodney M. Bates) (2002-11-06)
[1 later articles]
| List of all articles for this month |

From: "VBDis" <vbdis@aol.com>
Newsgroups: comp.compilers
Date: 13 Oct 2002 16:05:26 -0400
Organization: AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com
Keywords: C, semantics
Posted-Date: 13 Oct 2002 16:05:26 EDT

I've constructed a C grammar for CoCo/R, with only a few remaining
LL(1) errors. Now I want to create a parse tree, and have some
problems with the interpretation of the type declarations. The
following questions are independent from the grammar and tool type,
any hints are welcome:


How to create an parse tree in general?


It's easy to create an tree node for every reduction, with the reduced
tokens becoming children of that node. But how to create or transform
that tree in a way, that it reflects the semantics of the parsed text,
instead of the syntax?


How to interpret the type declaration syntax of C, in order to obtain
general type descriptions for every declaration?


The resulting description should express something like "pointer to:
array [...] of: ...", or some other straight type description. There
exist rules how to interpret type declarations "manually" (look right,
look left...), but I could not yet create equivalent code for an
automated interpretation of the scattered pieces of every declaration.


Where can I find sample C or C++ grammars (for download), with added
actions for the semantical interpretation of the rules?


TIA,
    DoDi


Post a followup to this message

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