/* "@(#)cpy.y 1.3 2/25/84"                                                                                                           */

%term     number stop DEFINED
%term     EQ NE LE GE LS RS
%term     ANDAND OROR
%left     ','
%right    '='
%right    '?' ':'
%left     OROR
%left     ANDAND
%left     '|' '^'
%left     '&'
%binary   EQ NE
%binary   '<' '>' LE GE
%left     LS RS
%left     '+' '-'
%left     '*' '/' '%'
%right    '!' '~' UMINUS
%left     '(' '.'

%%
S:        e stop    ={return($1);};
                                        /* Un ";" terminal a ete introduit le 20021212140259 lors de l'introduction de '$LACT15'.    */

e:        e '*' e
                    ={$$ = $1 * $3;}
     |    e '/' e
                    ={$$ = $1 / $3;}
     |    e '%' e
                    ={$$ = $1 % $3;}
     |    e '+' e
                    ={$$ = $1 + $3;}
     |    e '-' e
                    ={$$ = $1 - $3;}
     |    e LS e
                    ={$$ = $1 << $3;}
     |    e RS e
                    ={$$ = $1 >> $3;}
     |    e '<' e
                    ={$$ = $1 < $3;}
     |    e '>' e
                    ={$$ = $1 > $3;}
     |    e LE e
                    ={$$ = $1 <= $3;}
     |    e GE e
                    ={$$ = $1 >= $3;}
     |    e EQ e
                    ={$$ = $1 == $3;}
     |    e NE e
                    ={$$ = $1 != $3;}
     |    e '&' e
                    ={$$ = $1 & $3;}
     |    e '^' e
                    ={$$ = $1 ^ $3;}
     |    e '|' e
                    ={$$ = $1 | $3;}
     |    e ANDAND e
                    ={$$ = $1 && $3;}
     |    e OROR e
                    ={$$ = $1 || $3;}
     |    e '?' e ':' e
                    ={$$ = $1 ? $3 : $5;}
     |    e ',' e
                    ={$$ = $3;}
     |    term
                    ={$$ = $1;};
                                        /* Un ";" terminal a ete introduit le 20021212140259 lors de l'introduction de '$LACT15'.    */

term:
          '-' term  %prec UMINUS
                    ={$$ = -$2;}
     |    '!' term
                    ={$$ = !$2;}
     |    '~' term
                    ={$$ = ~$2;}
     |    '(' e ')'
                    ={$$ = $2;}
     |    DEFINED   '(' number ')'
                    ={$$= $3;}
     |    DEFINED   number
                    ={$$ = $2;}
     |    number
                    ={$$= $1;};
                                        /* Un ";" terminal a ete introduit le 20021212140259 lors de l'introduction de '$LACT15'.    */
%%

#include  "beau_yylex.c"



Copyright © Jean-François COLONNA, 2023-2024.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / École polytechnique, Institut Polytechnique de Paris, 2023-2024.