-(* L3 Compiler
+(* L4 Compiler
* Lexer
* Author: Kaustuv Chaudhuri <kaustuv+@cs.cmu.edu>
* Modified: Frank Pfenning <fp@cs.cmu.edu>
end
%%
-%header (functor L3LexFn(structure Tokens : L3_TOKENS));
+%header (functor L4LexFn(structure Tokens : L4_TOKENS));
%full
%s COMMENT COMMENT_LINE;
<INITIAL> ":" => (Tokens.COLON (yypos, yypos + size yytext));
<INITIAL> "," => (Tokens.COMMA (yypos, yypos + size yytext));
+<INITIAL> "[" => (Tokens.LBRACKET (yypos, yypos + size yytext));
+<INITIAL> "]" => (Tokens.RBRACKET (yypos, yypos + size yytext));
+<INITIAL> "->" => (Tokens.ARROW (yypos, yypos + size yytext));
+<INITIAL> "." => (Tokens.DOT (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> "var" => (Tokens.VAR (yypos, yypos + size yytext));
<INITIAL> "int" => (Tokens.INT (yypos, yypos + size yytext));
<INITIAL> "extern" => (Tokens.EXTERN (yypos, yypos + size yytext));
+<INITIAL> "struct" => (Tokens.STRUCT (yypos, yypos + size yytext));
+<INITIAL> "NULL" => (Tokens.NULL (yypos, yypos + size yytext));
+<INITIAL> "new" => (Tokens.NEW (yypos, yypos + size yytext));
<INITIAL> {decnum} => (number (yytext, yypos));