[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: doubts with shift-reduce and nonterminals
From: |
Mili Sandokan |
Subject: |
Re: doubts with shift-reduce and nonterminals |
Date: |
Tue, 24 Jan 2006 17:42:25 -0300 |
So, it isn´t that terrible to have a few shift reduce warnings in the
code, considering that my automata has 600+ states, am I right? I
mean.... the code should work anyway... : )
2006/1/24, Hans Aberg <address@hidden>:
> On 24 Jan 2006, at 16:11, Mili Sandokan wrote:
>
> > I know how to set precedence between tokens but i'm asking how to do
> > this when the " . " is between two non-terminals.... ¿can I show you
> > a piece of the output file?
>
> I do not remember the details how it works, and further, the method
> does not have the capacity of resolving all shift/reduce conflicts.
>
> > 81 s_condicional: T_IF '(' expresion ')' . sentencia_o_nada
> > 82 | T_IF '(' expresion ')' . sentencia_o_nada T_ELSE
>
> In this case, the tokens closest to the '.' are ')' and T_ELSE; so
> you should have token precedences set on those two. If you rewrite
> the rule as:
> cond: IF bool_expr THEN expr
> cond: IF bool_expr THEN expr ELSE expr
> then the tokens closest to '.', will be, I think THEN and ELSE, and
> token precedences should be set ointo those.
>
> So it is a very primitive method of resolving shift/resolve conflict,
> that doe not depend only the grammar, but how it is written in the
> form of rules.
>
> Hans Aberg
>
>
>