aboutsummaryrefslogtreecommitdiff
path: root/7/main.l
diff options
context:
space:
mode:
Diffstat (limited to '7/main.l')
-rw-r--r--7/main.l22
1 files changed, 22 insertions, 0 deletions
diff --git a/7/main.l b/7/main.l
new file mode 100644
index 0000000..7e1332f
--- /dev/null
+++ b/7/main.l
@@ -0,0 +1,22 @@
1%{
2#include "y.tab.h"
3extern int yylval;
4%}
5
6%%
7[0-9]+ {
8 yylval = atoi(yytext);
9 return NUM;
10}
11"+" return ADD;;
12"-" return SUB;
13"*" return MUL;
14"/" return DIV;
15"(" return LPAR;
16")" return RPAR;
17\n return 0;
18%%
19
20int yywrap() {
21 return 1;
22}