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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
/**
** \file parse/tiger-factory.hh
** \brief Declaration of parse::TigerFactory.
*/
#pragma once
#include <ast/all.hh>
#include <ast/fwd.hh>
#include <parse/location.hh>
namespace parse
{
ast::IntExp* make_IntExp(const location& location, int num);
ast::StringExp* make_StringExp(const location& location, std::string string);
ast::ObjectExp* make_ObjectExp(const location& location,
ast::NameTy* type_name);
ast::CallExp* make_CallExp(const location& location,
misc::symbol name,
ast::exps_type* args);
ast::MethodCallExp* make_MethodCallExp(const location& location,
misc::symbol name,
ast::exps_type* args,
ast::Var* object);
ast::RecordExp* make_RecordExp(const location& location,
ast::NameTy* type_name,
ast::fieldinits_type* fields);
ast::ArrayExp* make_ArrayExp(const location& location,
ast::NameTy* type_name,
ast::Exp* size,
ast::Exp* init);
ast::NilExp* make_NilExp(const location& location);
ast::SeqExp* make_SeqExp(const location& location, ast::exps_type* exps);
ast::AssignExp*
make_AssignExp(const location& location, ast::Var* var, ast::Exp* exp);
ast::IfExp* make_IfExp(const location& location,
ast::Exp* test,
ast::Exp* thenclause,
ast::Exp* elseclause);
ast::IfExp*
make_IfExp(const location& location, ast::Exp* test, ast::Exp* thenclause);
ast::WhileExp*
make_WhileExp(const location& location, ast::Exp* test, ast::Exp* body);
ast::ForExp* make_ForExp(const location& location,
ast::VarDec* vardec,
ast::Exp* hi,
ast::Exp* body);
ast::BreakExp* make_BreakExp(const location& location);
ast::LetExp*
make_LetExp(const location& location, ast::ChunkList* decs, ast::Exp* body);
ast::OpExp* make_OpExp(const location& location,
ast::Exp* left,
ast::OpExp::Oper oper,
ast::Exp* right);
ast::CastExp*
make_CastExp(const location& location, ast::Exp* exp, ast::Ty* ty);
ast::SimpleVar* make_SimpleVar(const location& location, misc::symbol name);
ast::FieldVar*
make_FieldVar(const location& location, ast::Var* var, misc::symbol name);
ast::SubscriptVar*
make_SubscriptVar(const location& location, ast::Var* var, ast::Exp* index);
/* Use expansion parameter pack to handle when we have one or empty arguments */
template <class... T> ast::exps_type* make_exps_type(T... exps);
ast::ChunkList* make_ChunkList(const location& location);
ast::TypeChunk* make_TypeChunk(const location& location);
ast::TypeDec*
make_TypeDec(const location& location, misc::symbol name, ast::Ty* ty);
ast::RecordTy* make_RecordTy(const location& location,
ast::fields_type* fields);
ast::ArrayTy* make_ArrayTy(const location& location, ast::NameTy* base_type);
template <class... T> ast::fields_type* make_fields_type(T... types);
ast::Field* make_Field(const location& location,
misc::symbol name,
ast::NameTy* type_name);
ast::NameTy* make_NameTy(const location& location, misc::symbol name);
template <class... T>
ast::fieldinits_type* make_fieldinits_type(T... inits_types);
ast::FieldInit*
make_FieldInit(const location& location, misc::symbol name, ast::Exp* init);
ast::ClassTy* make_ClassTy(const location& location,
ast::NameTy* super,
ast::ChunkList* decs);
ast::VarChunk* make_VarChunk(const location& location);
ast::VarDec* make_VarDec(const location& location,
misc::symbol name,
ast::NameTy* type_name,
ast::Exp* init);
ast::MethodChunk* make_MethodChunk(const location& location);
ast::MethodDec* make_MethodDec(const location& location,
misc::symbol name,
ast::VarChunk* formals,
ast::NameTy* result,
ast::Exp* body);
ast::FunctionDec* make_FunctionDec(const location& location,
misc::symbol name,
ast::VarChunk* formals,
ast::NameTy* result,
ast::Exp* body);
template <class... T> ast::FunctionChunk* make_FunctionChunk(T... args);
// For the custom tiger extension
ast::AssertExp* make_AssertExp(const location& location,
ast::Exp* condition);
} // namespace parse
#include <parse/tiger-factory.hxx>
|