# 2.11BSD#431 - /usr/src/usr.bin/eqn/e.y

##### Variables

    _FROM             X
    _INT              X
    _SUB              X
    _SUP              X
    _TO               X
    _UP               X
    _back             X
    _box              X
    _collist          X
    _diacrit          X
    _down             X
    _eqn              X
    _from             X
    _fwd              X
    _left             X
    _matrix           X
    _pbox             X
    _prec             X
    _right            X
    _sbox             X
    _sub              X
    _sup              X
    _tbox             X
    _to               X
    _up               X

       1: %{#
       2: /*	e.y	4.1	83/02/11	*/
       3: #include "e.h"
       4: #
       5: int fromflg;
       6: %}
       7: %term   CONTIG QTEXT SPACE THIN TAB
       8: %term   MATRIX LCOL CCOL RCOL COL
       9: %term   MARK LINEUP
      10: %term   SUM INT PROD UNION INTER
      11: %term   LPILE PILE CPILE RPILE ABOVE
      12: %term   DEFINE TDEFINE NDEFINE DELIM GSIZE GFONT INCLUDE
      13: %right  FROM TO
      14: %left   OVER SQRT
      15: %right  SUP SUB
      16: %right  SIZE FONT ROMAN ITALIC BOLD FAT
      17: %right  UP DOWN BACK FWD
      18: %left   LEFT RIGHT
      19: %right  DOT DOTDOT HAT TILDE BAR UNDER VEC DYAD
      20:
      21: %%
      22:
      23: stuff   : eqn   { putout($1); }
      24:     | error { error(!FATAL, "syntax error"); }
      25:     |   { eqnreg = 0; }
      26:     ;
      27:
      28: eqn : box
      29:     | eqn box   { eqnbox($1, $2, 0); }
      30:     | eqn lineupbox { eqnbox($1, $2, 1); }
      31:     | LINEUP    { lineup(0); }
      32:     ;
      33:
      34: lineupbox: LINEUP box   { $$ = $2; lineup(1); }
      35:     ;
      36:
      37: matrix  : MATRIX    { $$ = ct; } ;
      38:
      39: collist : column
      40:     | collist column
      41:     ;
      42:
      43: column  : lcol '{' list '}' { column('L', $1); }
      44:     | ccol '{' list '}' { column('C', $1); }
      45:     | rcol '{' list '}' { column('R', $1); }
      46:     | col '{' list '}'  { column('-', $1); }
      47:     ;
      48:
      49: lcol    : LCOL      { $$ = ct++; } ;
      50: ccol    : CCOL      { $$ = ct++; } ;
      51: rcol    : RCOL      { $$ = ct++; } ;
      52: col : COL       { $$ = ct++; } ;
      53:
      54: sbox    : sup box   %prec SUP   { $$ = $2; }
      55:     ;
      56:
      57: tbox    : to box    %prec TO    { $$ = $2; }
      58:     |       %prec FROM  { $$ = 0; }
      59:     ;
      60:
      61: box : box OVER box  { boverb($1, $3); }
      62:     | MARK box  { mark($2); }
      63:     | size box  %prec SIZE  { size($1, $2); }
      64:     | font box  %prec FONT  { font($1, $2); }
      65:     | FAT box   { fatbox($2); }
      66:     | SQRT box  { sqrt($2); }
      67:     | lpile '{' list '}'    { lpile('L', $1, ct); ct = $1; }
      68:     | cpile '{' list '}'    { lpile('C', $1, ct); ct = $1; }
      69:     | rpile '{' list '}'    { lpile('R', $1, ct); ct = $1; }
      70:     | pile '{' list '}' { lpile('-', $1, ct); ct = $1; }
      71:     | box sub box sbox  %prec SUB   { shift2($1, $3, $4); }
      72:     | box sub box       %prec SUB   { bshiftb($1, $2, $3); }
      73:     | box sup box       %prec SUP   { bshiftb($1, $2, $3); }
      74:     | int sub box sbox  %prec SUB   { integral($1, $3, $4); }
      75:     | int sub box       %prec SUB   { integral($1, $3, 0); }
      76:     | int sup box       %prec SUP   { integral($1, 0, $3); }
      77:     | int                   { integral($1, 0, 0); }
      78:     | left eqn right    { paren($1, $2, $3); }
      79:     | pbox
      80:     | box from box tbox %prec FROM  { fromto($1, $3, $4); fromflg=0; }
      81:     | box to box    %prec TO    { fromto($1, 0, $3); }
      82:     | box diacrit   { diacrit($1, $2); }
      83:     | fwd box   %prec UP    { move(FWD, $1, $2); }
      84:     | up box    %prec UP    { move(UP, $1, $2); }
      85:     | back box  %prec UP    { move(BACK, $1, $2); }
      86:     | down box  %prec UP    { move(DOWN, $1, $2); }
      87:     | matrix '{' collist '}'    { matrix($1); }
      88:     ;
      89:
      90: int : INT   { setintegral(); }
      91:     ;
      92:
      93: fwd : FWD text  { $$ = atoi((char *) $1); } ;
      94: up  : UP text   { $$ = atoi((char *) $1); } ;
      95: back    : BACK text { $$ = atoi((char *) $1); } ;
      96: down    : DOWN text { $$ = atoi((char *) $1); } ;
      97:
      98: diacrit : HAT   { $$ = HAT; }
      99:     | VEC   { $$ = VEC; }
     100:     | DYAD  { $$ = DYAD; }
     101:     | BAR   { $$ = BAR; }
     102:     | UNDER { $$ = UNDER; } /* under bar */
     103:     | DOT   { $$ = DOT; }
     104:     | TILDE { $$ = TILDE; }
     105:     | DOTDOT    { $$ = DOTDOT; } /* umlaut = double dot */
     106:     ;
     107:
     108: from    : FROM  { $$=ps; ps -= 3; fromflg = 1;
     109:         if(dbg)printf(".\tfrom: old ps %d, new ps %d, fflg %d\n", $$, ps, fromflg);
     110:         }
     111:     ;
     112:
     113: to  : TO    { $$=ps; if(fromflg==0)ps -= 3;
     114:             if(dbg)printf(".\tto: old ps %d, new ps %d\n", $$, ps);
     115:         }
     116:     ;
     117:
     118: left    : LEFT text { $$ = ((char *)$2)[0]; }
     119:     | LEFT '{'  { $$ = '{'; }
     120:     ;
     121:
     122: right   : RIGHT text    { $$ = ((char *)$2)[0]; }
     123:     | RIGHT '}' { $$ = '}'; }
     124:     |       { $$ = 0; }
     125:     ;
     126:
     127: list    : eqn   { lp[ct++] = $1; }
     128:     | list ABOVE eqn    { lp[ct++] = $3; }
     129:     ;
     130:
     131: lpile   : LPILE { $$ = ct; } ;
     132: cpile   : CPILE { $$ = ct; } ;
     133: pile    : PILE  { $$ = ct; } ;
     134: rpile   : RPILE { $$ = ct; } ;
     135:
     136: size    : SIZE text { $$ = ps; setsize((char *) $2); }
     137:     ;
     138:
     139: font    : ROMAN     { setfont(ROM); }
     140:     | ITALIC    { setfont(ITAL); }
     141:     | BOLD      { setfont(BLD); }
     142:     | FONT text { setfont(((char *)$2)[0]); }
     143:     ;
     144:
     145: sub : SUB   { shift(SUB); }
     146:     ;
     147:
     148: sup : SUP   { shift(SUP); }
     149:     ;
     150:
     151: pbox    : '{' eqn '}'   { $$ = $2; }
     152:     | QTEXT     { text(QTEXT, (char *) $1); }
     153:     | CONTIG    { text(CONTIG, (char *) $1); }
     154:     | SPACE     { text(SPACE, 0); }
     155:     | THIN      { text(THIN, 0); }
     156:     | TAB       { text(TAB, 0); }
     157:     | SUM       { funny(SUM); }
     158:     | PROD      { funny(PROD); }
     159:     | UNION     { funny(UNION); }
     160:     | INTER     { funny(INTER); }   /* intersection */
     161:     ;
     162:
     163: text    : CONTIG
     164:     | QTEXT
     165:     ;
     166:
     167: %%

#### Defined variables

_FROM defined in line 80; used 3 times

- in line 13, 58, 108

_INT defined in line 90; used 1 times

- in line 10

_SUB defined in line 75; used 5 times

- in line 15, 71-72(2), 145(2)

_SUP defined in line 76; used 5 times

- in line 15, 54, 73, 148(2)

_TO defined in line 81; used 3 times

- in line 13, 57, 113

_UP defined in line 86; used 3 times

- in line 17, 84, 94

_back defined in line 85; never used
_box defined in line 86; used 18 times

- in line 28-34(3), 54-73(15)

_collist defined in line 87; used 1 times

- in line 40

_diacrit defined in line 82; used 1 times

- in line 82

_down defined in line 86; never used
_eqn defined in line 78; used 6 times

- in line 23, 29-30(2), 127-128(2), 151

_from defined in line 80; never used
_fwd defined in line 83; never used
_left defined in line 78; used 2 times

- in line 14-18(2)

_matrix defined in line 87; used 1 times

- in line 87

_pbox defined in line 79; never used
_prec defined in line 86; used 8 times

- in line 54-64(5), 71-73(3)

_right defined in line 78; used 5 times

- in line 13-19(5)

_sbox defined in line 74; used 1 times

- in line 71

_sub defined in line 75; used 2 times

- in line 71-72(2)

_sup defined in line 76; used 2 times

- in line 54, 73

_tbox defined in line 80; never used
_to defined in line 81; used 1 times

- in line 57

_up defined in line 84; never used

Last modified: 1987-02-17 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1081 |