Hi!

What about using left recursive rules?

seq0: seq0 '0'
    | '0'
    ;

regards
Istvan

On Thu, Nov 26, 2009 at 10:49:47PM +0100, Daniel Rentz wrote:
> Hello everybody,
> 
> This is my first posting on this list, I have looked through the archive 
> for similar topics, but didn't find anything helpful.
> 
> The following grammar gives 2 shift/reduce conflicts. I have simplified 
> it as good as possible. The intention of the grammar is to "collect" 
> blocks of consecutive '0' and '1' characters from input until a 
> semicolon occurs.
> 
> start       : sequences ';' ;
> sequences   : sequences sequence | ;
> sequence    : seq0 | seq1 ;
> seq0        : '0' seq0 | '0' ;
> seq1        : '1' seq1 | '1' ;
> 
> I can understand that Bison finds the conflicts, e.g.
> 
> state 5
> 
>     6 seq0: '0' . seq0
>     7     | '0' .
> 
>     '0'  shift, and go to state 5
> 
>     '0'       [reduce using rule 7 (seq0)]
>     $default  reduce using rule 7 (seq0)
> 
>     seq0  go to state 10
> 
> My question: How can I tell Bison that shifting is really intended?
> 
> 
> Best regards
> Daniel
> 
> 
> _______________________________________________
> help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison


_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to