-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastree.h
35 lines (29 loc) · 1.17 KB
/
astree.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
#ifndef __ASTREE_H__
#define __ASTREE_H__
#include <string>
#include <vector>
using namespace std;
#include "auxlib.h"
struct astree {
int symbol; // token code
size_t filenr; // index into filename stack
size_t linenr; // line number from source code
size_t offset; // offset of token with current line
const string* lexinfo; // pointer to lexical information
bool noBlock; // used to make a block not open an new scope
string type; // type information
vector<astree*> children; // children of this n-way node
};
astree* new_astree (int symbol, int filenr, int linenr,
int offset, const char* lexinfo);
astree* new_astree (int symbol, const char* lexinfo);
astree* adopt1 (astree* root, astree* child);
astree* adopt_front (astree* root, astree* child);
astree* adopt2 (astree* root, astree* left, astree* right);
astree* adopt1sym (astree* root, astree* child, int symbol);
void dump_astree (FILE* outfile, astree* root);
void yyprint (FILE* outfile, unsigned short toknum,
astree* yyvaluep);
void free_ast (astree* tree);
void free_ast2 (astree* tree1, astree* tree2);
#endif