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