summaryrefslogtreecommitdiff
path: root/src/parse_expr.ll
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2016-09-19 21:14:58 +0000
committerTuowen Zhao <ztuowen@gmail.com>2016-09-19 21:14:58 +0000
commit210f77d2c32f14d2e99577fd3c9842bb19d47e50 (patch)
tree5edb327c919b8309e301c3440fb6668a0075c8ef /src/parse_expr.ll
parenta66ce5cd670c4d3c0dc449720f5bc45dd4c281b8 (diff)
downloadchill-210f77d2c32f14d2e99577fd3c9842bb19d47e50.tar.gz
chill-210f77d2c32f14d2e99577fd3c9842bb19d47e50.tar.bz2
chill-210f77d2c32f14d2e99577fd3c9842bb19d47e50.zip
Moved most modules into lib
Diffstat (limited to 'src/parse_expr.ll')
-rw-r--r--src/parse_expr.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/parse_expr.ll b/src/parse_expr.ll
new file mode 100644
index 0000000..a9b389f
--- /dev/null
+++ b/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];
+%%
+