Annotation of researchv10no/cmd/cpp/cpy.y, revision 1.1.1.1

1.1       root        1: %{
                      2: /*#ident       "@(#)cpp:common/cpy.y   1.5"*/
                      3: %}
                      4: %{
                      5: %}
                      6: %term number stop DEFINED
                      7: %term EQ NE LE GE LS RS
                      8: %term ANDAND OROR
                      9: %left ','
                     10: %right '='
                     11: %right '?' ':'
                     12: %left OROR
                     13: %left ANDAND
                     14: %left '|' '^'
                     15: %left '&'
                     16: %binary EQ NE
                     17: %binary '<' '>' LE GE
                     18: %left LS RS
                     19: %left '+' '-'
                     20: %left '*' '/' '%'
                     21: %right '!' '~' UMINUS
                     22: %left '(' '.'
                     23: %%
                     24: S:     e stop  ={return($1);}
                     25: 
                     26: 
                     27: e:       e '*' e
                     28:                ={$$ = $1 * $3;}
                     29:        | e '/' e
                     30:                ={
                     31:                        if ($3 == 0) {
                     32:                                ppwarn("division by zero");
                     33:                                $$ = 0;
                     34:                        }
                     35:                        else
                     36:                                $$ = $1 / $3;
                     37:                }
                     38:        | e '%' e
                     39:                ={
                     40:                        if ($3 == 0) {
                     41:                                ppwarn("remainder by zero");
                     42:                                $$ = 0;
                     43:                        }
                     44:                        else
                     45:                                $$ = $1 % $3;
                     46:                }
                     47:        | e '+' e
                     48:                ={$$ = $1 + $3;}
                     49:        | e '-' e
                     50:                ={$$ = $1 - $3;}
                     51:        | e LS e
                     52:                ={$$ = $1 << $3;}
                     53:        | e RS e
                     54:                ={$$ = $1 >> $3;}
                     55:        | e '<' e
                     56:                ={$$ = $1 < $3;}
                     57:        | e '>' e
                     58:                ={$$ = $1 > $3;}
                     59:        | e LE e
                     60:                ={$$ = $1 <= $3;}
                     61:        | e GE e
                     62:                ={$$ = $1 >= $3;}
                     63:        | e EQ e
                     64:                ={$$ = $1 == $3;}
                     65:        | e NE e
                     66:                ={$$ = $1 != $3;}
                     67:        | e '&' e
                     68:                ={$$ = $1 & $3;}
                     69:        | e '^' e
                     70:                ={$$ = $1 ^ $3;}
                     71:        | e '|' e
                     72:                ={$$ = $1 | $3;}
                     73:        | e ANDAND e
                     74:                ={$$ = $1 && $3;}
                     75:        | e OROR e
                     76:                ={$$ = $1 || $3;}
                     77:        | e '?' e ':' e
                     78:                ={$$ = $1 ? $3 : $5;}
                     79:        | e ',' e
                     80:                ={$$ = $3;}
                     81:        | term
                     82:                ={$$ = $1;}
                     83: term:
                     84:          '-' term %prec UMINUS
                     85:                ={$$ = -$2;}
                     86:        | '!' term
                     87:                ={$$ = !$2;}
                     88:        | '~' term
                     89:                ={$$ = ~$2;}
                     90:        | '(' e ')'
                     91:                ={$$ = $2;}
                     92:        | DEFINED '(' number ')'
                     93:                ={$$= $3;}
                     94:        | DEFINED number
                     95:                ={$$ = $2;}
                     96:        | number
                     97:                ={$$= $1;}
                     98: %%

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.