diff options
Diffstat (limited to 'parse_expr.ll')
-rw-r--r-- | parse_expr.ll | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/parse_expr.ll b/parse_expr.ll new file mode 100644 index 0000000..e97a1db --- /dev/null +++ b/parse_expr.ll @@ -0,0 +1,25 @@ +%{ +// some C++ code +#include "chill_run_util.hh" +#include "parse_expr.tab.hh" +%} + +%option noyywrap +%option header-file="parse_expr.ll.hh" + +%% +[ \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]; +%% + |