Related articles |
---|
Symbol-Table and Parse-trees blizzar@hem1.passagen.se (1999-08-12) |
Re: Symbol-Table and Parse-trees rkrayhawk@aol.com (1999-08-13) |
Re: Symbol-Table and Parse-trees delta-t@t-online.de (Leif Leonhardy) (1999-08-15) |
Re: Symbol-Table and Parse-trees cgbatema@undergrad.math.uwaterloo.ca (1999-08-15) |
From: | Leif Leonhardy <delta-t@t-online.de> |
Newsgroups: | comp.compilers |
Date: | 15 Aug 1999 10:42:08 -0400 |
Organization: | delta t Computerservice |
References: | 99-08-048 |
Keywords: | parse, symbols |
Peter Palotas schrieb:
>
> I'm wondering what the best way is to handle declarations in a C
> compiler? During the initial parse (sytatic analysis), should one put
> the declarations in the symbol-table immediately, and not in the parse
> tree, or should one wait and put them in the sym-tbl only during
> semantic analysis?
Unless using 2-level grammars or something like that, you HAVE TO put
declarations into a symbol table immediately to be used by the scanner
(lexical analyzer) because there's no CFG for C syntax, i.e. you can't
parse C without letting the scanner know if an instance of
[a-zA-Z_][a-zA-Z0-9_]* is a typename or an identifier in the current
scope.
Leif
Return to the
comp.compilers page.
Search the
comp.compilers archives again.