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