Initial commit
[ccc.git] / scan.l
1 %option noinput
2 %option nounput
3 %{
4
5 #include <stdio.h>
6 #include "ast.h"
7 #define YYSTYPE struct ast *
8 #include "y.tab.h"
9 extern YYSTYPE yylval;
10
11 %}
12
13 %%
14
15 [0-9]+ { yylval = ast_int(atoi(yytext)); return INTEGER; }
16 \+ return PLUS;
17 - return MINUS;
18 \* return TIMES;
19 \/ return DIVIDE;
20 \( return BOPEN;
21 \) return BCLOSE;
22 \; return SEMICOLON;
23 [ \n\t] ;
24
25 %%