Re: Semantic (Type) analysis phase question

Pablo Moisset <pmoisset@usc.edu>
25 Mar 2000 02:43:04 -0500

          From comp.compilers

Related articles
Compiler project needed pel@realtime.dk (Per Olesen) (2000-02-22)
Semantic (Type) analysis phase question lojedaortiz@interlink.com.ar (Nicolás) (2000-03-23)
Re: Semantic (Type) analysis phase question thp@roam-thp2.cs.ucr.edu (Tom Payne) (2000-03-23)
Re: Semantic (Type) analysis phase question pmoisset@usc.edu (Pablo Moisset) (2000-03-25)
Re: Semantic (Type) analysis phase question rkrayhawk@aol.com (2000-04-01)
Re: Semantic (Type) analysis phase question tmoog@polhode.com (Tom Moog) (2000-04-03)
| List of all articles for this month |
From: Pablo Moisset <pmoisset@usc.edu>
Newsgroups: comp.compilers
Date: 25 Mar 2000 02:43:04 -0500
Organization: University of Southern California, Los Angeles, CA
References: 00-02-112 00-03-097
Keywords: types

As usual, it depends on your problem


You can overlap parsing and semantic checking phases in a single pass,
and it is not hard to do it...if the source language helps. If you are
compiling PASCAL is a piece of cake, however, if you are compiling a
language with forward references (like a call to a function that is
defined later in the same file, without using C-like prototypes or
PASCAL-like forward declarations ), it is better to create an
intermediate representation form first (during the parsing) and doing
all the checks in a later pass.


Hope this helps you


Pablo


"Nicolás" wrote:


> Where should I check for semantic correctnes (type correctness, mostly) ?
> Is it better to do it in the parsing phase, while I am building the parse
> tree, or to do it after I have a complete parse tree, traversing the tree
> in post order ?


Post a followup to this message

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