]> Joshua Wise's Git repositories - snipe.git/blobdiff - parse/l3.lex
Initial import of l3c
[snipe.git] / parse / l3.lex
similarity index 93%
rename from parse/l2.lex
rename to parse/l3.lex
index 9caa8e1a829e4fc91469f47a958c4002372af63a..d9c2217876c5e16338a8463a6a09bed4c6c20e5e 100644 (file)
@@ -1,4 +1,4 @@
-(* L2 Compiler
+(* L3 Compiler
  * Lexer
  * Author: Kaustuv Chaudhuri <kaustuv+@cs.cmu.edu>
  * Modified: Frank Pfenning <fp@cs.cmu.edu>
@@ -51,7 +51,7 @@ in
 end
 
 %%
-%header (functor L2LexFn(structure Tokens : L2_TOKENS));
+%header (functor L3LexFn(structure Tokens : L3_TOKENS));
 %full
 %s COMMENT COMMENT_LINE;
 
@@ -105,6 +105,9 @@ ws = [\ \t\012];
 <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));
@@ -112,6 +115,10 @@ ws = [\ \t\012];
 <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));
 
This page took 0.025672 seconds and 4 git commands to generate.