1 %term CONTIG QTEXT SPACE THIN TAB
2 %term MATRIX LCOL CCOL RCOL COL ABOVE
4 %term SUM INT PROD UNION INTER
5 %term DEFINE TDEFINE NDEFINE DELIM GSIZE GFONT INCLUDE SPACE IFDEF
11 %right SIZE FONT ROMAN ITALIC BOLD FAT
12 %right UP DOWN BACK FWD
14 %right DOT DOTDOT HAT TILDE BAR LOWBAR HIGHBAR UNDER VEC DYAD UTILDE
24 stuff
: eqn
{ putout
($1); }
25 |
error { ERROR
"syntax error" WARNING
; } /* should be SYNTAX */
30 | eqn box
{ eqnbox
($1, $2, 0); }
31 | eqn lineupbox
{ eqnbox
($1, $2, 1); }
32 | LINEUP
{ lineup
(0); }
35 lineupbox: LINEUP box
{ $$
= $2; lineup
(1); }
38 sbox
: SUP box %prec SUP
{ $$
= $2; }
39 | %prec SUP
{ $$
= 0; }
42 tbox
: TO box %prec TO
{ $$
= $2; }
43 | %prec FROM
{ $$
= 0; }
46 box
: '{' eqn
'}' { $$
= $2; }
47 | QTEXT
{ text
(QTEXT
, (char *) $1); }
48 | CONTIG
{ text
(CONTIG
, (char *) $1); }
49 | SPACE
{ text
(SPACE
, (char *) 0); }
50 | THIN
{ text
(THIN
, (char *) 0); }
51 | TAB
{ text
(TAB
, (char *) 0); }
53 | PROD
{ funny
(PROD
); }
54 | UNION
{ funny
(UNION
); }
55 | INTER
{ funny
(INTER
); }
56 | box OVER box
{ boverb
($1, $3); }
57 | MARK box
{ mark
($2); }
58 | size box %prec SIZE
{ size
($1, $2); }
59 | font box %prec FONT
{ font
($1, $2); }
60 | FAT box
{ fatbox
($2); }
61 | SQRT box
{ sqrtx
($2); }
62 | box SUB
{ps
-= deltaps
;} box sbox %prec SUB
{ subsup
($1, $4, $5); }
63 | box SUP
{ps
-= deltaps
;} box %prec SUP
{ subsup
($1, 0, $4); }
64 |
int SUB
{ps
-= deltaps
;} box sbox %prec SUB
{ integral
($1, $4, $5); }
65 |
int SUP
{ps
-= deltaps
;} box %prec SUP
{ integral
($1, 0, $4); }
66 |
int { integral
($1, 0, 0); }
67 | box FROM
{ps
-= deltaps
;} box tbox %prec FROM
{ fromto
($1, $4, $5); }
68 | box TO
{ps
-= deltaps
;} box %prec TO
{ fromto
($1, 0, $4); }
69 | left eqn right
{ paren
($1, $2, $3); }
70 | left eqn
{ paren
($1, $2, 0); }
71 | box diacrit
{ diacrit
($1, $2); }
72 | fwd box %prec UP
{ move
(FWD
, $1, $2); }
73 | up box %prec UP
{ move
(UP
, $1, $2); }
74 | back box %prec UP
{ move
(BACK
, $1, $2); }
75 | down box %prec UP
{ move
(DOWN
, $1, $2); }
76 | column
{ pile
($1); ct
= $1; }
77 | MATRIX
{$$
=ct
;} '{' collist
'}' { matrix
($2); ct
= $2; }
80 int : INT
{ setintegral
(); }
83 fwd
: FWD text
{ $$
= atoi
((char *) $1); } ;
84 up
: UP text
{ $$
= atoi
((char *) $1); } ;
85 back
: BACK text
{ $$
= atoi
((char *) $1); } ;
86 down
: DOWN text
{ $$
= atoi
((char *) $1); } ;
88 diacrit
: HAT
{ $$
= HAT
; }
92 | LOWBAR
{ $$
= LOWBAR
; }
93 | HIGHBAR
{ $$
= HIGHBAR
; }
94 | UNDER
{ $$
= UNDER
; } /* underbar */
96 | TILDE
{ $$
= TILDE
; }
97 | UTILDE
{ $$
= UTILDE
; }
98 | DOTDOT
{ $$
= DOTDOT
; } /* umlaut = double dot */
101 left
: LEFT text
{ $$
= ((char *)$2)[0]; }
102 | LEFT
'{' { $$
= '{'; }
105 right
: RIGHT text
{ $$
= ((char *)$2)[0]; }
106 | RIGHT
'}' { $$
= '}'; }
113 column
: col
'{' list
'}' { column
($1, DEFGAP
); }
114 | col text
{$$
=atoi
((char*)$2);} '{' list
'}' { column
($1, $3); }
117 col
: LCOL
{ $$
= startcol
(LCOL
); }
118 | CCOL
{ $$
= startcol
(CCOL
); }
119 | RCOL
{ $$
= startcol
(RCOL
); }
120 | COL
{ $$
= startcol
(COL
); }
123 list
: eqn
{ lp
[ct
++] = $1; }
124 | list ABOVE eqn
{ lp
[ct
++] = $3; }
127 size
: SIZE text
{ $$
= ps
; setsize
((char *) $2); }
130 font
: ROMAN
{ static char R
[]="R"; setfont
(R
); }
131 | ITALIC
{ static char I
[]="I"; setfont
(I
); }
132 | BOLD
{ static char B
[]="B"; setfont
(B
); }
133 | FONT text
{ setfont
((char *)$2); }