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
Return to the
comp.compilers page.
Search the
comp.compilers archives again.