aboutsummaryrefslogtreecommitdiff
path: root/src/tpc.lex
diff options
context:
space:
mode:
authorAdam NAILI2018-04-22 15:32:40 +0200
committerAdam NAILI2018-04-22 15:32:40 +0200
commita431f189d33af68ea179e464c889761e65ed1f08 (patch)
tree2da926fa6eccd0d2b9459be841fd0168d474e607 /src/tpc.lex
parent5d83670f6b0b142bcda19270d3c9b50f9370bee8 (diff)
downloadtpc-compiler-a431f189d33af68ea179e464c889761e65ed1f08.tar.gz
Basic implementation of the symbol table
Diffstat (limited to 'src/tpc.lex')
-rw-r--r--src/tpc.lex7
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
9int lineno = 1; 10int 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; }
25entier { strcpy(yylval.type, yytext); return TYPE; } 26entier { yylval.type = INT; return TYPE; }
26caractere { strcpy(yylval.type, yytext); return TYPE; } 27caractere { yylval.type = CHAR; return TYPE; }
27void { return VOID; } 28void { return VOID; }
28const { return CONST; } 29const { return CONST; }
29if { return IF; } 30if { return IF; }