forked from Vbhaskar125/COOL-Compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cool-tree.handcode.h
105 lines (73 loc) · 2.81 KB
/
cool-tree.handcode.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//
// The following include files must come first.
#ifndef COOL_TREE_HANDCODE_H
#define COOL_TREE_HANDCODE_H
#include <iostream>
#include "tree.h"
#include "cool.h"
#include "stringtab.h"
#define yylineno curr_lineno;
extern int yylineno;
inline Boolean copy_Boolean(Boolean b) {return b; }
inline void assert_Boolean(Boolean) {}
inline void dump_Boolean(ostream& stream, int padding, Boolean b)
{ stream << pad(padding) << (int) b << "\n"; }
void dump_Symbol(ostream& stream, int padding, Symbol b);
void assert_Symbol(Symbol b);
Symbol copy_Symbol(Symbol b);
class Program_class;
typedef Program_class *Program;
class Class__class;
typedef Class__class *Class_;
class Feature_class;
typedef Feature_class *Feature;
class Formal_class;
typedef Formal_class *Formal;
class Expression_class;
typedef Expression_class *Expression;
class Case_class;
typedef Case_class *Case;
typedef list_node<Class_> Classes_class;
typedef Classes_class *Classes;
typedef list_node<Feature> Features_class;
typedef Features_class *Features;
typedef list_node<Formal> Formals_class;
typedef Formals_class *Formals;
typedef list_node<Expression> Expressions_class;
typedef Expressions_class *Expressions;
typedef list_node<Case> Cases_class;
typedef Cases_class *Cases;
#define Program_EXTRAS \
virtual void semant() = 0; \
virtual void dump_with_types(ostream&, int) = 0;
#define program_EXTRAS \
void semant(); \
void dump_with_types(ostream&, int);
#define Class__EXTRAS \
virtual Symbol get_filename() = 0; \
virtual void dump_with_types(ostream&,int) = 0;
#define class__EXTRAS \
Symbol get_filename() { return filename; } \
void dump_with_types(ostream&,int);
#define Feature_EXTRAS \
virtual void dump_with_types(ostream&,int) = 0;
#define Feature_SHARED_EXTRAS \
void dump_with_types(ostream&,int);
#define Formal_EXTRAS \
virtual void dump_with_types(ostream&,int) = 0;
#define formal_EXTRAS \
void dump_with_types(ostream&,int);
#define Case_EXTRAS \
virtual void dump_with_types(ostream& ,int) = 0;
#define branch_EXTRAS \
void dump_with_types(ostream& ,int);
#define Expression_EXTRAS \
Symbol type; \
Symbol get_type() { return type; } \
Expression set_type(Symbol s) { type = s; return this; } \
virtual void dump_with_types(ostream&,int) = 0; \
void dump_type(ostream&, int); \
Expression_class() { type = (Symbol) NULL; }
#define Expression_SHARED_EXTRAS \
void dump_with_types(ostream&,int);
#endif