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) |
From: | SM Ryan <wyrmwif@tsoft.org> |
Newsgroups: | comp.compilers |
Date: | 13 Oct 2006 00:51:39 -0400 |
Organization: | Quick STOP Groceries |
References: | 06-10-057 |
Keywords: | algol60, parse |
Posted-Date: | 13 Oct 2006 00:51:39 EDT |
Chris F Clark <cfc@shell01.TheWorld.com> wrote:
# SM Ryan <wyrmwif@tsoft.org> writes:
# much that I had no quibbles with, but finished with this:
# > # [You could try building types into the grammar like boolean_variable
# > # and boolean_function_designator, but it's not going to be pretty. -John]
# >
# > Unless you use a two-level grammar, you cannot write enough productions.
#
# We are talking Algol 60 here, right? There seem to be two relevant
# types: numerics and booleans. Thus, the number of expression rules
# merely doubles. (In theory it could quadruple for that case, but that
# would mean one whould need operators that have a numeric expression on
# one side and a boolean on the other, which Algol 60 didn't.) If you
The problem is you can't distinguish Boolean variable from arithmetic
variable merely by looking variable characters themselves. You need to
match the variable to its declaration and that requires a context
sensitive grammar. In a context free grammar a Boolean variable and
arithmetic variable (or function names) are indistinguishable hence
the reduce-reduce conflict.
# were talking Algol 68, you would need a 2-level grammar, but an Algol
# 60 grammar should be hand-disambiguable, aside from the issue of
# typing a specific variable, for which the C-typedef solution (have the
# lexer return two different types) should suffice. Perhaps, SM means to
That's still using a context sensitive grammar.
--
SM Ryan http://www.rawbw.com/~wyrmwif/
[Has there ever been a useful truly context free parser? 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]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.