2 b larl(a)

mckeeman at wivax.UUCP mckeeman at wivax.UUCP
Thu May 31 01:42:05 AEST 1984


Following my ``<ident> ::= IF'' suggestion, Brian Thomson writes

>>>Actually, I believe this would fail in most cases, at least for
>>>the IF keyword.  If your grammar contains
>>>
>>>   <statement> ::= IF <expression> THEN ....
>>>   <ident>     ::= IF
>>>
>>>and an <expression> may begin with a left parenthesis
>>>it will fail to be LALR(1) because of the resulting shift-reduce conflict.
>>>'IF (' is a prefix of a valid procedure call.
>>>I don't know of any way to resolve the conflict, do you?
>>>--

Ooops.  You are right.  My constructor (flesh & blood)
fails to handle IF followed by '('.  All readers should
delete my claim until and if I can restate it accurately.
The actual history of my hasty statement is a PL/I subset
where we used this trick to conform to the 'no reserved
word' definition of that language.  It failed only on NOT
as I remember, but now I am unwilling to trust foggy
memories and unable to run a system dead these many years.

/s/ Bill   McKeeman.Wang-Inst at CSNet-Relay
           ...decvax!wivax!mckeeman
           Wang Institute of Graduate Studies, Tyngsboro, MA 01879



More information about the Comp.lang.c mailing list