Annotation of 42BSD/usr.bin/f77/src/f77pass1/gram.expr, revision 1.1.1.1

1.1       root        1: funarglist:
                      2:                { $$ = 0; }
                      3:        | funargs
                      4:        ;
                      5: 
                      6: funargs:  expr
                      7:                { $$ = mkchain($1, CHNULL); }
                      8:        | funargs SCOMMA expr
                      9:                { $$ = hookup($1, mkchain($3,CHNULL) ); }
                     10:        ;
                     11: 
                     12: 
                     13: expr:    uexpr
                     14:        | SLPAR expr SRPAR
                     15:                { if (optimflag)
                     16:                        $$ = mkexpr(OPPAREN, $2, ENULL);
                     17:                  else $$ = $2;
                     18:                }
                     19:        | complex_const
                     20:        ;
                     21: 
                     22: uexpr:   lhs
                     23:        | simple_const
                     24:        | expr addop expr   %prec SPLUS
                     25:                { $$ = mkexpr($2, $1, $3); }
                     26:        | expr SSTAR expr
                     27:                { $$ = mkexpr(OPSTAR, $1, $3); }
                     28:        | expr SSLASH expr
                     29:                { $$ = mkexpr(OPSLASH, $1, $3); }
                     30:        | expr SPOWER expr
                     31:                { $$ = mkexpr(OPPOWER, $1, $3); }
                     32:        | addop expr  %prec SSTAR
                     33:                { if($1 == OPMINUS)
                     34:                        $$ = mkexpr(OPNEG, $2, ENULL);
                     35:                  else  $$ = $2;
                     36:                }
                     37:        | expr relop expr  %prec SEQ
                     38:                { $$ = mkexpr($2, $1, $3); }
                     39:        | expr SEQV expr
                     40:                { NO66(".EQV. operator");
                     41:                  $$ = mkexpr(OPEQV, $1,$3); }
                     42:        | expr SNEQV expr
                     43:                { NO66(".NEQV. operator");
                     44:                  $$ = mkexpr(OPNEQV, $1, $3); }
                     45:        | expr SOR expr
                     46:                { $$ = mkexpr(OPOR, $1, $3); }
                     47:        | expr SAND expr
                     48:                { $$ = mkexpr(OPAND, $1, $3); }
                     49:        | SNOT expr
                     50:                { $$ = mkexpr(OPNOT, $2, ENULL); }
                     51:        | expr SCONCAT expr
                     52:                { NO66("concatenation operator //");
                     53:                  $$ = mkexpr(OPCONCAT, $1, $3); }
                     54:        ;
                     55: 
                     56: addop:   SPLUS         { $$ = OPPLUS; }
                     57:        | SMINUS        { $$ = OPMINUS; }
                     58:        ;
                     59: 
                     60: relop:   SEQ   { $$ = OPEQ; }
                     61:        | SGT   { $$ = OPGT; }
                     62:        | SLT   { $$ = OPLT; }
                     63:        | SGE   { $$ = OPGE; }
                     64:        | SLE   { $$ = OPLE; }
                     65:        | SNE   { $$ = OPNE; }
                     66:        ;
                     67: 
                     68: lhs:    name
                     69:                { $$ = mkprim($1, PNULL, CHNULL); }
                     70:        | name substring
                     71:                { NO66("substring operator :");
                     72:                  $$ = mkprim($1, PNULL, $2); }
                     73:        | name SLPAR funarglist SRPAR
                     74:                { $$ = mkprim($1, mklist($3), CHNULL); }
                     75:        | name SLPAR funarglist SRPAR substring
                     76:                { NO66("substring operator :");
                     77:                  $$ = mkprim($1, mklist($3), $5); }
                     78:        ;
                     79: 
                     80: substring:  SLPAR opt_expr SCOLON opt_expr SRPAR
                     81:                { $$ = mkchain($2, mkchain($4,CHNULL)); }
                     82:        ;
                     83: 
                     84: opt_expr:
                     85:                { $$ = 0; }
                     86:        | expr
                     87:        ;
                     88: 
                     89: 
                     90: simple_const:   STRUE  { $$ = mklogcon(1); }
                     91:        | SFALSE        { $$ = mklogcon(0); }
                     92:        | SHOLLERITH  { $$ = mkstrcon(toklen, token); }
                     93:        | SICON = { $$ = mkintcon( convci(toklen, token) ); }
                     94:        | SRCON = { $$ = mkrealcon(TYREAL, convcd(toklen, token)); }
                     95:        | SDCON = { $$ = mkrealcon(TYDREAL, convcd(toklen, token)); }
                     96:        ;
                     97: 
                     98: complex_const:  SLPAR uexpr SCOMMA uexpr SRPAR
                     99:                { $$ = mkcxcon($2,$4); }
                    100:        ;
                    101: 
                    102: 
                    103: fexpr:   unpar_fexpr
                    104:        | SLPAR fexpr SRPAR
                    105:                { if (optimflag)
                    106:                        $$ = mkexpr(OPPAREN, $2, ENULL);
                    107:                  else $$ = $2;
                    108:                }
                    109:        ;
                    110: 
                    111: unpar_fexpr:     lhs
                    112:        | simple_const
                    113:        | fexpr addop fexpr   %prec SPLUS
                    114:                { $$ = mkexpr($2, $1, $3); }
                    115:        | fexpr SSTAR fexpr
                    116:                { $$ = mkexpr(OPSTAR, $1, $3); }
                    117:        | fexpr SSLASH fexpr
                    118:                { $$ = mkexpr(OPSLASH, $1, $3); }
                    119:        | fexpr SPOWER fexpr
                    120:                { $$ = mkexpr(OPPOWER, $1, $3); }
                    121:        | addop fexpr  %prec SSTAR
                    122:                { if($1 == OPMINUS)
                    123:                        $$ = mkexpr(OPNEG, $2, ENULL);
                    124:                  else  $$ = $2;
                    125:                }
                    126:        | fexpr SCONCAT fexpr
                    127:                { NO66("concatenation operator //");
                    128:                  $$ = mkexpr(OPCONCAT, $1, $3); }
                    129:        ;

unix.superglobalmegacorp.com

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