aboutsummaryrefslogtreecommitdiff
path: root/src/symboltable.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/symboltable.c')
-rw-r--r--src/symboltable.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/symboltable.c b/src/symboltable.c
index 852d1b8..3f22b44 100644
--- a/src/symboltable.c
+++ b/src/symboltable.c
@@ -28,8 +28,29 @@ void lookup(const char name[]) {
28 if (!strcmp(symbol_table.entries[count].name, name)) { 28 if (!strcmp(symbol_table.entries[count].name, name)) {
29 return; 29 return;
30 } 30 }
31 printf("No definition of the variable %s near line %d\n", name,
32 lineno);
33 } 31 }
32 printf("No definition of the variable %s near line %d\n", name,
33 lineno);
34}
35
36void display_table(){
37 int count;
38 for (count=0;count<symbol_table.size;count++) {
39 if(symbol_table.entries[count].type == INT)
40 printf("entier: %s, pos: %d \n", symbol_table.entries[count].name, symbol_table.entries[count].addr);
41 else
42 printf("caractere: %s, pos: %d \n", symbol_table.entries[count].name, symbol_table.entries[count].addr);
43 }
44 printf("\n");
34} 45}
35 46
47int get_type(const char name[]){
48 int count;
49
50 for (count = 0; count < symbol_table.size; count++) {
51 if (!strcmp(symbol_table.entries[count].name, name)) {
52 return symbol_table.entries[count].type;
53 }
54 }
55 return -1;
56} \ No newline at end of file