diff options
author | pacien | 2018-02-23 01:11:34 +0100 |
---|---|---|
committer | pacien | 2018-02-23 01:11:34 +0100 |
commit | 806dd4ff649a1fb9a28dc469cc17d7dd5dbc1da5 (patch) | |
tree | da414ebbb1807a2dea82235faa429f6e6613db69 /src/tpc.lex | |
parent | 11acfa2e75350d31a665b8ee99925916c2c8b5f1 (diff) | |
download | tpc-compiler-806dd4ff649a1fb9a28dc469cc17d7dd5dbc1da5.tar.gz |
Adapt for new grammar
Diffstat (limited to 'src/tpc.lex')
-rw-r--r-- | src/tpc.lex | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/tpc.lex b/src/tpc.lex index 63d4391..8b824c0 100644 --- a/src/tpc.lex +++ b/src/tpc.lex | |||
@@ -16,15 +16,13 @@ int lineno = 1; | |||
16 | [ \t\r]+ ; | 16 | [ \t\r]+ ; |
17 | \n { lineno++; } | 17 | \n { lineno++; } |
18 | "/*" { BEGIN COMMENT; } | 18 | "/*" { BEGIN COMMENT; } |
19 | && { return AND; } | 19 | "&&" { return AND; } |
20 | "||" { return OR; } | 20 | "||" { return OR; } |
21 | "*"|"/"|% { return DIVSTAR; } | 21 | "*"|"/"|% { return DIVSTAR; } |
22 | "+"|- { return ADDSUB; } | 22 | "+"|- { return ADDSUB; } |
23 | "<"|"<="|">"|>= { return ORDER; } | 23 | "<"|"<="|">"|">=" { return ORDER; } |
24 | ==|!= { return EQ; } | 24 | ==|!= { return EQ; } |
25 | int { return TYPE; } | 25 | int { return TYPE; } |
26 | float { return TYPE; } | ||
27 | double { return TYPE; } | ||
28 | char { return TYPE; } | 26 | char { return TYPE; } |
29 | void { return VOID; } | 27 | void { return VOID; } |
30 | const { return CONST; } | 28 | const { return CONST; } |
@@ -32,6 +30,9 @@ if { return IF; } | |||
32 | else { return ELSE; } | 30 | else { return ELSE; } |
33 | while { return WHILE; } | 31 | while { return WHILE; } |
34 | return { return RETURN; } | 32 | return { return RETURN; } |
33 | print { return PRINT; } | ||
34 | readc { return READC; } | ||
35 | reade { return READE; } | ||
35 | [a-zA-Z_][a-zA-Z0-9_]* { return IDENT; } | 36 | [a-zA-Z_][a-zA-Z0-9_]* { return IDENT; } |
36 | [0-9]+ { return NUM; } | 37 | [0-9]+ { return NUM; } |
37 | '\\?.' { return CARACTERE; } | 38 | '\\?.' { return CARACTERE; } |