|Compiler project needed firstname.lastname@example.org (Per Olesen) (2000-02-22)|
|Semantic (Type) analysis phase question email@example.com (Nicolás) (2000-03-23)|
|Re: Semantic (Type) analysis phase question firstname.lastname@example.org (Tom Payne) (2000-03-23)|
|Re: Semantic (Type) analysis phase question email@example.com (Pablo Moisset) (2000-03-25)|
|Re: Semantic (Type) analysis phase question firstname.lastname@example.org (2000-04-01)|
|Re: Semantic (Type) analysis phase question email@example.com (Tom Moog) (2000-04-03)|
|From:||Pablo Moisset <firstname.lastname@example.org>|
|Date:||25 Mar 2000 02:43:04 -0500|
|Organization:||University of Southern California, Los Angeles, CA|
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
> 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 ?
Return to the
Search the comp.compilers archives again.