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




_______________________________________________
[email protected] http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to