-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathast_def.h
45 lines (33 loc) · 961 Bytes
/
ast_def.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
// Group 13
// Sahil Dubey - 2017A7PS0096P
// Rohit Milind Rajhans - 2017A7PS0105P
// Saujas Adarkar - 2017A7PS0109P
#ifndef _AST_
#define _AST_
#include <stdio.h>
#include "parser_def.h"
#include "symbol_table_def.h"
#include "label.h"
typedef struct symbol_table_tree_node* Symbol_Table_Tree;
typedef struct symbol_node Symbol_Node;
// Structure for a node of the abstract syntax tree
// Contains a pointer to a lexeme for all leaf nodes
// Also has a pointer for symbol table node created later for variables
typedef struct ast_node {
Label label;
int tag;
int rule_num;
struct ast_node* parent;
struct ast_node* next;
struct ast_node* child;
Node* leaf_token;
Symbol_Node* symbol_table_node;
Symbol_Table_Tree current_scope;
} AST_Node;
typedef AST_Node* AST;
typedef struct list_AST {
AST node;
AST index;
struct list_AST* next;
} AST_list;
#endif