
%{

char *typeset_pred(char *pred);

%}

%%

"("             OPEN
"["             OPEN
")"             CLOSE
"]"             CLOSE

";"             SEMI	{ ";" }
".."            DOTDOT
"."             DOT
","             COMMA	{ ", " }
"##"            BLOCK	{ "$[]$" }
"-->"           ARROW	{ "$\\longrightarrow$" }
":"             COLON	{ " : " }

":="            BECOMES	{ "$\\leftarrow$" }

"skip"          SKIP	{ "\\underline{\\bf skip}" }
"abort"         ABORT	{ "\\underline{\\bf abort}" }
"array"         ARRAY	{ "{\\bf array}" }
"of"            OF	{ "{\\bf of}" }

"do"            DO	{ "\\underline{\\bf do}" }
"od"            OD	{ "\\underline{\\bf od}" }
"if"            IF	{ "\\underline{\\bf if}" }
"fi"            FI	{ "\\underline{\\bf fi}" }

"|["            OPENBLOCK   { "$|[$" }
"]|"            CLOSEBLOCK  { "$]|$" }

"!"             UNARY_OP    { "$\\neg$" }
"~"             UNARY_OP    { "$\\neg$" }
"-"             MINUS

"<"		BINARY_OP   { "$<$" }
">"		BINARY_OP   { "$>$" }
"<="		BINARY_OP   { "$\\leq$" }
">="		BINARY_OP   { "$\\geq$" }
"+"             BINARY_OP
"*"             BINARY_OP   { "$\\times$" }
"/"             BINARY_OP   { "\\underline{\\bf div}" }
"div"           BINARY_OP   { "\\underline{\\bf div}" }
"%"             BINARY_OP   { "\\underline{\\bf mod}" }
"mod"           BINARY_OP   { "\\underline{\\bf mod}" }
"="             BINARY_OP   { "$=$" }
"=="            BINARY_OP   { "$=$" }
"!="            BINARY_OP   { "$\\neq$" }
"/="            BINARY_OP   { "$\\neq$" }
"max"           BINARY_OP   { "\\underline{\\bf max}" }
"min"           BINARY_OP   { "\\underline{\\bf min}" }

"var"           ACCESS	    { "\\underline{\\bf var}" }
"con"           ACCESS	    { "\\underline{\\bf con}" }

"swap"          SWAP        { "\\underline{\\bf swap}" }

"int"           TYPE	    { "{\\bf integer}" }
"integer"       TYPE	    { "{\\bf integer}" }
"bool"          TYPE	    { "{\\bf boolean}" }
"boolean"       TYPE	    { "{\\bf boolean}" }

[a-zA-Z]+       ID	    { "$\\mathit{" ** "}$" }
[0-9][0-9]*     NUMBER	    { "$" ** "$" }

"{>".*"<}"      PREDICATE   { "$\\{" [create(typeset_pred(yytext))] " \\}$" }
^"@use\ ".*     CHUNK       { "\n" ** "\n" }

[\t\ \n]

