help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ambiguous Grammar: Clarification


From: Hans Aberg
Subject: Re: Ambiguous Grammar: Clarification
Date: Tue, 27 May 2003 13:51:22 +0200

At 15:05 +0530 2003/05/27, Ramaswamy wrote:
>    Hi,   > Bison does not do that matching for the  longest rule, so you
>end up with an
>> grammar ambiguity. If one writes it  like you did, you will end up with a
>> state
>>   Token -> A  .
>>   C     -> A . B
>> That is, a  shift/reduce conflict. If you want to have the longest match,
>> you should  shift here, which Bison does by default, so you can ask it
>>to   if bison shifts by default then why does  the output file with the
>>verbose option give $default [reduce  ....]

That is the default action, that does not have anything to do with the
actions taken for the other lookahead tokens.

See the parsing algorithms in text books like Aho, Stehi, Ullman,
"Compilers...", or the Parsing Techniques book:
http://www.cs.vu.nl/~dick/PTAPG.html


  Hans Aberg






reply via email to

[Prev in Thread] Current Thread [Next in Thread]