%START NORM VERB INVERB MATH SYNTAX sp [ \t]* verb \n{sp}@{sp}\n math \n{sp}\"{sp}\n synt \n{sp}@@@{sp}\n nl {sp}\n{sp} %{ #define PUSH states[top++] = #define POP BEGIN states[--top] int yywrap (void) { return 1; } %} %% int states[256]; int top; BEGIN NORM; top = 0; @@ { printf ("@"); } @ { printf ("\\mbox{\\tt "); PUSH NORM; BEGIN INVERB; } " " { printf ("\\ "); } @ { printf ("}"); POP; } \# { printf ("{\\char'43}"); } \${ printf ("{\\char'44}"); } \% { printf ("{\\char'45}"); } \& { printf ("{\\char'46}"); } \~ { printf ("{\\char'176}"); } \_ { printf ("{\\char'137}"); } \^ { printf ("{\\char'136}"); } \\ { printf ("{\\char'134}"); } \{ { printf ("{\\char'173}"); } \} { printf ("{\\char'175}"); } {verb} { printf ("\\begin{verbatim}\n"); PUSH NORM; BEGIN VERB; } {verb} { printf ("\\end{verbatim}\n"); POP; } \"\" { printf ("\""); } \"{sp} { printf ("\\mbox{$\\it "); PUSH NORM; BEGIN MATH; } $\left\{sp\right\}\" \left\{ printf \left("\right\}"\right); POP; \right\}\left\{math\right\}\left\{sp\right\} \left\{ printf \left("\n\\\left[\n\\it "\right); PUSH NORM; BEGIN MATH; \right\}\left\{sp\right\}\left\{math\right\} \left\{ printf \left("\n\\\right]\n"\right); POP; \right\}\left\{nl\right\} \left\{ printf \left("\\\\\n\\it "\right); \right\}\left\{sp\right\}&\left\{sp\right\} \left\{ printf \left("&\\it "\right); \right\}\\\left\{nl\right\} \left\{ \right\}\left\{sp\right\} \left\{ printf \left("\\ "\right); \right\}"..." \left\{ printf \left("\\ldots "\right); \right\}">=" \left\{ printf \left("\\geq "\right); \right\}"<=" \left\{ printf \left("\\leq "\right); \right\}"->" \left\{ printf \left("\\rightarrow "\right); \right\}"<-" \left\{ printf \left("\\leftarrow "\right); \right\}@@ \left\{ printf \left("@"\right); \right\}@ \left\{ printf \left("\\makebox\left\{\\tt "\right); PUSH MATH; BEGIN INVERB; \right\}\left\{synt\right\}\left\{sp\right\} \left\{ printf \left("\n\\begin\left\{flushleft\right\}"\right); printf \left("\\it\\begin\left\{tabular\right\}\left\{lcll\right\}\n\\it "\right); BEGIN SYNTAX; \right\}\left\{sp\right\}\left\{synt\right\} \left\{ printf \left("\n\\end\left\{tabular\right\}\\end\left\{flushleft\right\}\n"\right); BEGIN NORM; \right\}\left\{nl\right\} \left\{ printf \left("\\\\ \n\\it "\right); \right\}\left\{sp\right\}"->"\left\{sp\right\} \left\{ printf \left(" & \\makebox\left[3.5em\right]\left\{\\rightarrow\right\} &"\right); printf \left("\\it "\right); \right\}\left\{nl\right\}"|"\left\{sp\right\} \left\{ printf \left("\\\\ \n\\it "\right); printf \left(" & \\makebox\left[3.5em\right]\left\{|\right\} & \\it "\right); \right\}\left\{sp\right\}&\left\{sp\right\} \left\{ printf \left(" & ~~~~\\it "\right); \right\}\left\{nl\right\} \left\{ /* this is for the HTML output: to get a blank row in a table, it needs to contain something, so we add a non-breaking space */ printf \left("\\\\ \n~\\\\\n\\it "\right); \right\}\\\left\{nl\right\} \left\{ \right\}\left\{sp\right\} \left\{ printf \left("\\ "\right); \right\}"..." \left\{ printf \left("\\ldots "\right); \right\}">=" \left\{ printf \left("\\geq "\right); \right\}"<=" \left\{ printf \left("\\leq "\right); \right\}"->" \left\{ printf \left("\\rightarrow "\right); \right\}"<-" \left\{ printf \left("\\leftarrow "\right); \right\}@@ \left\{ printf \left("@"\right); \right\}@ \left\{ printf \left("\\makebox\left\{\\tt "\right); PUSH SYNTAX; BEGIN INVERB; \right\} %% int main\left(\right) \left\{ yylex\left(\right); return\left(0\right); \right\}$