-(* L2 Compiler
+(* L3 Compiler
* Lexer
* Author: Kaustuv Chaudhuri <kaustuv+@cs.cmu.edu>
* Modified: Frank Pfenning <fp@cs.cmu.edu>
end
%%
-%header (functor L2LexFn(structure Tokens : L2_TOKENS));
+%header (functor L3LexFn(structure Tokens : L3_TOKENS));
%full
%s COMMENT COMMENT_LINE;
<INITIAL> ">=" => (Tokens.GE (yypos, yypos + size yytext));
<INITIAL> ">" => (Tokens.GT (yypos, yypos + size yytext));
+<INITIAL> ":" => (Tokens.COLON (yypos, yypos + size yytext));
+<INITIAL> "," => (Tokens.COMMA (yypos, yypos + size yytext));
+
<INITIAL> "return" => (Tokens.RETURN (yypos, yypos + size yytext));
<INITIAL> "if" => (Tokens.IF (yypos, yypos + size yytext));
<INITIAL> "while" => (Tokens.WHILE (yypos, yypos + size yytext));
<INITIAL> "continue" => (Tokens.CONTINUE (yypos, yypos + size yytext));
<INITIAL> "break" => (Tokens.BREAK (yypos, yypos + size yytext));
<INITIAL> "else" => (Tokens.ELSE (yypos, yypos + size yytext));
+<INITIAL> "var" => (Tokens.VAR (yypos, yypos + size yytext));
+<INITIAL> "int" => (Tokens.INT (yypos, yypos + size yytext));
+<INITIAL> "extern" => (Tokens.EXTERN (yypos, yypos + size yytext));
+
<INITIAL> {decnum} => (number (yytext, yypos));