Re: Am I parsing this correctly? (when do I build the symbol table)

Chris Dollin <chris.dollin@hp.com>
Mon, 21 May 2007 09:01:01 +0100

          From comp.compilers

Related articles
[3 earlier articles]
Re: Am I parsing this correctly? (when do I build the symbol table) DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-05-19)
Re: Am I parsing this correctly? (when do I build the symbol table) mburrel@uwo.ca (Mike Burrell) (2007-05-19)
Re: Am I parsing this correctly? (when do I build the symbol table) jeffrey.kenton@comcast.net (Jeff Kenton) (2007-05-19)
Re: Am I parsing this correctly? (when do I build the symbol table) gneuner2@comcast.net (George Neuner) (2007-05-19)
Re: Am I parsing this correctly? (when do I build the symbol table) 148f3wg02@sneakemail.com (Karsten Nyblad) (2007-05-20)
Re: Am I parsing this correctly? (when do I build the symbol table) ulimakesacompiler@googlemail.com (Uli Kusterer) (2007-05-20)
Re: Am I parsing this correctly? (when do I build the symbol table) chris.dollin@hp.com (Chris Dollin) (2007-05-21)
Re: Am I parsing this correctly? (when do I build the symbol table) ulimakesacompiler@googlemail.com (Uli Kusterer) (2007-05-22)
Re: Am I parsing this correctly? (when do I build the symbol table) gah@ugcs.caltech.edu (glen herrmannsfeldt) (2007-05-23)
Re: Am I parsing this correctly? (when do I build the symbol table) paul@paul-robinson.us (Paul Robinson) (2007-05-31)
| List of all articles for this month |
From: Chris Dollin <chris.dollin@hp.com>
Newsgroups: comp.compilers
Date: Mon, 21 May 2007 09:01:01 +0100
Organization: HP labs, Bristol
References: 07-05-067 07-05-072
Keywords: parse, symbols
Posted-Date: 21 May 2007 13:34:53 EDT

Jeff Kenton wrote:


> In general, you should be building the symbol table as you parse.


I would have said that /in general/ you want to keep the symbol
table well out of it while parsing. Having the syntax depend on
what the declarations are makes, I believe, for a fragile grammar.
Some languages are pretty much stuck with that fragility, but that's
not an excuse to copy it.


Decoupling the parse from the semantics like this makes the parser
easier to write, and makes the symbol table easier to work with
as well.


> If there is information about an identifier that's missing, that
> should be explicitly noted as you proceed. If it's still missing
> when you finish parsing, you will need to report errors or apply
> defaults, depending on the language specifications.


Even if you decouple the symbol table from the parser, you can still
do this one layer up (read a top-level construct, do the symbol-table
working, etc). What's important, IMAO, is that the parser not need
access to the symbol table just to make parsing decisions.


--
"I just wonder when we're going to have to sit down and re-evaluate /Sahara/
our decision-making paradigm."


Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN


Post a followup to this message

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