aboutsummaryrefslogtreecommitdiff
path: root/src/symbol_table.h
blob: 9926fec1c6a4a887fc144ed49bb61b627c7af382 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
 * UPEM / Compilation / Projet
 * Pacien TRAN-GIRARD, Adam NAILI
 */

#ifndef __SYMBOL_TABLE_H__
#define __SYMBOL_TABLE_H__

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAXNAME 32
#define INT 0
#define CHAR 1
#define MAXSYMBOLS 256

typedef struct {
  char name[MAXNAME];
  int type;
  int addr;
} STentry;

typedef struct {
  STentry entries[MAXSYMBOLS];
  int maxsize;
  int size;
} SymbolTable;

void glo_addVar(const char name[], int type);
int glo_lookup(const char name[]);
int glo_get_addr(const char name[]);
void glo_display_table();
void loc_addVar(const char name[], int type);
int loc_lookup(const char name[]);
int loc_get_addr(const char name[]);
void loc_display_table();
void check_expected_type(int type_to_check, int type_expected);

#endif