Hello,
i'm programming an SQL grammar using YACC and during compilation i got this error:
conflits: 1 shift/reduce, 2 reduce/reduce
the first error : shift/reduce
Code:
scalar_exp:
scalar_exp PLUS scalar_exp
| scalar_exp NEG scalar_exp
| scalar_exp MULT scalar_exp
| scalar_exp DIV scalar_exp
| atom
| column_ref
| function_ref
| OPENPAREN scalar_exp CLOSEPAREN
;
function_ref:
AMMSC OPENPAREN MULT CLOSEPAREN /* COUNT(*) */
| AMMSC OPENPAREN DISTINCT column_ref CLOSEPAREN
| AMMSC OPENPAREN ALL scalar_exp CLOSEPAREN
| AMMSC OPENPAREN scalar_exp CLOSEPAREN
;
the error is that MULT appears twice in the code
Code:
MULT [réduction par utilisation de la règle 212 (parameter)]
the second erro: 2 reduce/reduce
Code:
88 values_or_query_spec: VALUES OPENPAREN . insert_atom_commalist CLOSEPAREN
STRING décalage et aller à l'état 57
INTNUM décalage et aller à l'état 58
APPROXNUM décalage et aller à l'état 59
USER décalage et aller à l'état 61
NULLX décalage et aller à l'état 305
DEUXPOINT décalage et aller à l'état 63
INDICATOR réduction par utilisation de la règle 212 (parameter)
CLOSEPAREN réduction par utilisation de la règle 90 (insert_atom_commalist)
CLOSEPAREN [réduction par utilisation de la règle 212 (parameter)]
COMMA réduction par utilisation de la règle 90 (insert_atom_commalist)
COMMA [réduction par utilisation de la règle 212 (parameter)]
$défaut réduction par utilisation de la règle 90 (insert_atom_commalist)
insert_atom_commalist aller à l'état 306
insert_atom aller à l'état 307
atom aller à l'état 308
parameter_ref aller à l'état 68
literal aller à l'état 70
parameter aller à l'état 72
the two conflics are about comma and CLOSEOPEN
Code:
CLOSEPAREN réduction par utilisation de la règle 90 (insert_atom_commalist)
CLOSEPAREN [réduction par utilisation de la règle 212 (parameter)]
COMMA réduction par utilisation de la règle 90 (insert_atom_commalist)
COMMA [réduction par utilisation de la règle 212 (parameter)]
$défaut réduction par utilisation de la règle 90 (insert_atom_commalist)
the error is about CLOSEPAREN and COMMA
the grammar:
Code:
values_or_query_spec:
VALUES OPENPAREN insert_atom_commalist CLOSEPAREN
| query_spec
;
insert_atom_commalist:
| insert_atom
| insert_atom_commalist COMMA insert_atom
;
insert_atom:
atom
| NULLX
;
i'm asking for giving me the solution if you can
tanks