summaryrefslogtreecommitdiff
path: root/chill/src/parse_expr.ll
diff options
context:
space:
mode:
Diffstat (limited to 'chill/src/parse_expr.ll')
-rw-r--r--chill/src/parse_expr.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/chill/src/parse_expr.ll b/chill/src/parse_expr.ll
new file mode 100644
index 0000000..a9b389f
--- /dev/null
+++ b/chill/src/parse_expr.ll
@@ -0,0 +1,24 @@
+%{
+// some C++ code
+#include "chill_run_util.hh"
+#include "parse_expr.tab.hh"
+%}
+
+%option noyywrap
+
+%%
+[ \t]+ /*ignore*/
+\n /*ignore*/
+L[0-9]+ { yylval.val = atoi(&yytext[1]); return LEVEL; }
+[0-9]+ { yylval.val = atoi(yytext); return NUMBER; }
+\<\= return LE;
+\>\= return GE;
+\=(\=)? return EQ;
+[a-zA-Z_][a-zA-Z_0-9]* {
+ yylval.str_val = new char[yyleng+1];
+ strcpy(yylval.str_val, yytext);
+ return VARIABLE;
+ }
+. return (int)yytext[0];
+%%
+