-
Notifications
You must be signed in to change notification settings - Fork 0
/
parsetree.h
47 lines (33 loc) · 841 Bytes
/
parsetree.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
#ifndef PARSETREE
#define PARSETREE
#include <vector>
#include <stack>
#include <iostream>
#include <cstdlib>
#include <vector>
#include <stack>
#include <cstdio>
#include <iostream>
#include "tokenType.h"
//#include "decaf.tab.h"
/* we are building parse trees */
/* prototype for yyerror, needed on my linux laptop */
int yyerror(const char * s);
using namespace std;
enum PTtype {TERMINAL, NONTERMINAL};
struct Symtab;
struct ParseTree {
Symtab *symtab;
PTtype type;
string description;
Token * token;
string s_type; //Type assigned in type checking
int dimension; //Assigned in type checking
vector<ParseTree *> children;
ParseTree(string description);
ParseTree(Token * tokp);
void addChild(ParseTree * tree);
string toString();
};
void traverseTree(ParseTree * tree, int depth, int seq);
#endif