diff options
author | Adam NAILI | 2018-04-22 15:32:40 +0200 |
---|---|---|
committer | Adam NAILI | 2018-04-22 15:32:40 +0200 |
commit | a431f189d33af68ea179e464c889761e65ed1f08 (patch) | |
tree | 2da926fa6eccd0d2b9459be841fd0168d474e607 /src/tpc.lex | |
parent | 5d83670f6b0b142bcda19270d3c9b50f9370bee8 (diff) | |
download | tpc-compiler-a431f189d33af68ea179e464c889761e65ed1f08.tar.gz |
Basic implementation of the symbol table
Diffstat (limited to 'src/tpc.lex')
-rw-r--r-- | src/tpc.lex | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tpc.lex b/src/tpc.lex index 5137d39..7a0d6b6 100644 --- a/src/tpc.lex +++ b/src/tpc.lex | |||
@@ -5,7 +5,8 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include "tpc.tab.h" | 7 | #include "tpc.tab.h" |
8 | 8 | #define INT 0 | |
9 | #define CHAR 1 | ||
9 | int lineno = 1; | 10 | int lineno = 1; |
10 | %} | 11 | %} |
11 | 12 | ||
@@ -22,8 +23,8 @@ int lineno = 1; | |||
22 | "+"|- { yylval.addsub=yytext[0]; return ADDSUB; } | 23 | "+"|- { yylval.addsub=yytext[0]; return ADDSUB; } |
23 | "<"|"<="|">"|">=" { strcpy(yylval.comp, yytext); return ORDER; } | 24 | "<"|"<="|">"|">=" { strcpy(yylval.comp, yytext); return ORDER; } |
24 | ==|!= { strcpy(yylval.comp, yytext); return EQ; } | 25 | ==|!= { strcpy(yylval.comp, yytext); return EQ; } |
25 | entier { strcpy(yylval.type, yytext); return TYPE; } | 26 | entier { yylval.type = INT; return TYPE; } |
26 | caractere { strcpy(yylval.type, yytext); return TYPE; } | 27 | caractere { yylval.type = CHAR; return TYPE; } |
27 | void { return VOID; } | 28 | void { return VOID; } |
28 | const { return CONST; } | 29 | const { return CONST; } |
29 | if { return IF; } | 30 | if { return IF; } |