summaryrefslogtreecommitdiff
path: root/misc-test/compilateur_c_en_c/table_sym.h
blob: e26977f70a445b18d0a080cf960a37a19839e342 (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
#ifndef TABLE_SYM_H
#define TABLE_SYM_H 

struct symbolEntry {
	char * symName;
	unsigned int address;
	int readOnly;
	int initialized; // 0 : non , 1: oui, 2: peut-être ^^
	unsigned int contextProf;
};


// TODO : déclarer liste chainée d'instructions
struct instruction {
//	unsigned int numi; // Numéro d'instruction
	char *label; // Label de la ligne courante (0 = pas de label)
	unsigned int opcode; // Code operation (cf table correspondance pour avoir la forme textuelle)
	unsigned int op1, op2, op3; // Operandes
};

struct symbolStackCell {
	struct symbolEntry *symbol;
	struct symbolStackCell *next;
};

typedef struct symbolStackCell*  symbolStack;

void symbolPush(symbolStack *symStack, struct symbolEntry *sym);
struct symbolEntry * symbolFind(symbolStack symStack, char *symName, int contextMinProf, int contextMaxProf);
void printSymTable(symbolStack symStack);
void cleanSymStack(symbolStack *symStack, int contextProf);
#endif /*TABLE_SYM_H*/