diff options
Diffstat (limited to '7/main.l')
-rw-r--r-- | 7/main.l | 22 |
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" | ||
3 | extern 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 | |||
20 | int yywrap() { | ||
21 | return 1; | ||
22 | } | ||