-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsym.h
87 lines (58 loc) · 1.26 KB
/
sym.h
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <stdio.h>
#include <string.h>
#define SIZE 256;
#define VARIABLES 1;
#define PROC 2;
#define STRUCT_STMT 3;
typedef struct items
{
char *var;
int return_type;
int type;
char *name_struct;
char *field_of;
}items;
typedef struct HashTable
{
items **items;
int size;
int count;
}HashTable;
typedef struct symbol
{
char *name;
HashTable *hash_table;
struct symbol *next;
struct symbol *prev;
int internal_scope;
int is_struct;
struct symbol *inner_scope;
int return_type;
}symbol;
typedef struct table
{
symbol *head;
symbol *curr;
}table;
int add_to_scope(int type, char *n);
int is_struct(int integer);
int check_name(char *name);
void new_scope();
void *print_symbol_table();
void *create_symbol_table();
HashTable* create_hash_table();
void add_internal_scope();
void delete_scope();
unsigned long hash_function(char *variable);
int check_scope(char *name);
int add_struct_to_scope(char *field);
int check_if_struct(char *name);
void store_struct_name(char *name);
void add_struct_name();
ExpType* return_type(char *var);
int check_if_field(char *stmt);
add_struct(char *name);
void store_return_type(int type);
ExpType* get_return_type_current_proc();
int get_return_type_of_a_proc(char *name);
int check_for_main();