]> Joshua Wise's Git repositories - snipe.git/blobdiff - parse/l4.lex
Initial import of l4c
[snipe.git] / parse / l4.lex
similarity index 91%
rename from parse/l3.lex
rename to parse/l4.lex
index d9c2217876c5e16338a8463a6a09bed4c6c20e5e..b988c3548851c533e6bb2215a7380305a961e7ca 100644 (file)
@@ -1,4 +1,4 @@
-(* L3 Compiler
+(* L4 Compiler
  * Lexer
  * Author: Kaustuv Chaudhuri <kaustuv+@cs.cmu.edu>
  * Modified: Frank Pfenning <fp@cs.cmu.edu>
@@ -51,7 +51,7 @@ in
 end
 
 %%
-%header (functor L3LexFn(structure Tokens : L3_TOKENS));
+%header (functor L4LexFn(structure Tokens : L4_TOKENS));
 %full
 %s COMMENT COMMENT_LINE;
 
@@ -108,6 +108,11 @@ ws = [\ \t\012];
 <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));
@@ -118,6 +123,9 @@ ws = [\ \t\012];
 <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));
This page took 0.023366 seconds and 4 git commands to generate.