-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathast.h
58 lines (44 loc) · 884 Bytes
/
ast.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
#ifndef _AST
#define _AST
#include "lexerDef.h"
#include "lexer.h"
#include "parser.h"
typedef struct _arrayTypeInfo
{
tokenID type ;
token *tokLeft ;
token *tokRight ;
} arrayTypeInfo ;
typedef enum _datTag
{
PRIMITIVE, ARRAY, DARRAY
} datTag ;
typedef tokenID primitive ;
typedef union _datType
{
primitive pType ;
arrayTypeInfo *arrType ;
} datType ;
/*
typedef struct _token
{
tokenID id ;
char *lexeme ;
int lineNumber ;
} token ;
*/
struct _moduleST ;
typedef struct _moduleST moduleST ;
typedef struct _astNode
{
tokenID id ;
token *tok ;
datTag dtTag ;
datType *dt ;
moduleST *localST ;
struct _astNode *parent , *child , *next, *prev ;
} astNode ;
astNode* applyASTRule (treeNode *PTNode) ;
void inorderAST (astNode *node, int space) ;
void preorderAST (astNode *node, int space) ;
#endif