Ambiguous AST ? (=?ISO-8859-1?Q?Nicol=E1s_Ojeda_B=E4r?=)
9 Mar 2002 03:12:51 -0500

          From comp.compilers

Related articles
Ambiguous AST ? (2002-03-09)
Re: Ambiguous AST ? (Ira D. Baxter) (2002-03-11)
Re: Ambiguous AST ? (Joachim Durchholz) (2002-03-11)
Re: Ambiguous AST ? (2002-03-11)
| List of all articles for this month |

From: (=?ISO-8859-1?Q?Nicol=E1s_Ojeda_B=E4r?=)
Newsgroups: comp.compilers
Date: 9 Mar 2002 03:12:51 -0500
Keywords: parse, design, question
Posted-Date: 09 Mar 2002 03:12:51 EST


I am writing a front end for something like Pascal. I want to separate
as much as possible the parsing from the semantic analysis,
intermediate code, and code generation in order to mantain a clear

Clearly, I want to postpone symbol table creation to a second pass
over the ast created during parsing (otherwise, i.e. if I were
creating the symbol tables during parsing, it wouldn't be logical to
delay e.g. type checking until later). Now, Pascal's syntax is
semantically ambiguous, in particular one cannot know if a identifier
in an expression is a variable reference or a function call without

My question is the following: since I have no way of knowing which
case it is without symbol table information (which I have not
collected during parsing time), would it be
practical/logical/realistic to have an "ambiguous" ast data structure
(an ast node that doesn't specify which of the two cases I have
encountered) and then translate that (during semantic analysis) to the
corresponding data structure (according to the info collected while
processing the declarations).

Any kind of comment/option/etc would be inmensely appreciated.


Post a followup to this message

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