Re: Reduce/Reduce conflict in Algol60 grammar

Robert A Duff <bobduff@shell01.TheWorld.com>
14 Oct 2006 16:10:05 -0400

          From comp.compilers

Related articles
Reduce/Reduce conflict in Algol60 grammar leonardo@dcc.ufmg.br (Leonardo Teixeira Passos) (2006-10-10)
Re: Reduce/Reduce conflict in Algol60 grammar luvisi@andru.sonoma.edu (Andru Luvisi) (2006-10-11)
Re: Reduce/Reduce conflict in Algol60 grammar idknow@gmail.com (idknow@gmail.com) (2006-10-11)
Re: Reduce/Reduce conflict in Algol60 grammar wyrmwif@tsoft.org (SM Ryan) (2006-10-11)
Re: Reduce/Reduce conflict in Algol60 grammar cfc@shell01.TheWorld.com (Chris F Clark) (2006-10-12)
Re: Reduce/Reduce conflict in Algol60 grammar wyrmwif@tsoft.org (SM Ryan) (2006-10-13)
Re: Reduce/Reduce conflict in Algol60 grammar kenrose@nc-sys.com (Ken Rose) (2006-10-14)
Re: Reduce/Reduce conflict in Algol60 grammar bobduff@shell01.TheWorld.com (Robert A Duff) (2006-10-14)
Re: Reduce/Reduce conflict in Algol60 grammar DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-10-14)
Re: Reduce/Reduce conflict in Algol60 grammar cfc@shell01.TheWorld.com (Chris F Clark) (2006-10-15)
| List of all articles for this month |

From: Robert A Duff <bobduff@shell01.TheWorld.com>
Newsgroups: comp.compilers
Date: 14 Oct 2006 16:10:05 -0400
Organization: The World Public Access UNIX, Brookline, MA
References: 06-10-057 06-10-058
Keywords: parse

Our esteemed moderator wrote:


> [Has there ever been a useful truly context free parser?


Sure, lots. IMHO that's the right way to do things, except when the
language design gets in the way.


And I think encoding type information in the grammar is a losing
proposition. I say, let semantic analysis deal with types, and avoid
feedback from semantic analysis into the parser or lexer. "Separation
of concerns" is the appropriate buzzword here.


Here's an example: GNAT (the GNU Ada compiler). The parser deals with
"defining identifier" tokens and "usage identifier" tokens (which are
distinguished by the grammar in a purely context-free manner), and
builds a syntax tree. It knows nothing about the type of each
identifier. A separate semantic analysis phase figures out the type
of each expression (including identifiers).


> ...All the ones I've written have cheated by using symbol table info
> to decide what symbol to return for a variable name and the like. I
> presume that's what Chris is suggesting. -John]


- Bob



Post a followup to this message

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