51 virtual void print(
int indent = 0) = 0;
61 std::shared_ptr<Node> stmt;
62 std::shared_ptr<Node> code;
65 StatementCode(std::shared_ptr<Node> stmt, std::shared_ptr<Node> code) : stmt(stmt), code(code) {
70 void print(
int)
override;
82 void print(
int indent)
override;
95 Id(std::string
id) : id(id) {
100 void print(
int indent)
override;
112 void print(
int indent)
override;
124 void print(
int indent)
override;
136 void print(
int indent)
override;
148 void print(
int indent)
override;
158 std::shared_ptr<Node> code;
161 Loop(std::shared_ptr<Node> code) : code(code) {
166 void print(
int indent)
override;
177 std::shared_ptr<Node> code;
208 void print(
int indent)
override;
218 std::shared_ptr<Node> code;
221 Seq(std::shared_ptr<Node> code) : code(code) {
226 void print(
int indent)
override;
236 std::shared_ptr<Node> ifParam;
239 If(std::shared_ptr<Node> ifParam) : ifParam(ifParam) {
244 void print(
int indent)
override;
254 std::shared_ptr<Node> code;
255 std::shared_ptr<Node> else_;
258 IfParam(std::shared_ptr<Node> code, std::shared_ptr<Node> else_) : code(code), else_(else_) {
263 void print(
int indent)
override;
273 std::shared_ptr<Node> code;
276 CodeElse(std::shared_ptr<Node> code) : code(code) {
281 void print(
int indent)
override;
std::string generateIfCondition(Generator &generator)
Generates a condition string for an if statement.
Definition ast.cpp:9
void printIndentationSpaces(int indent)
Prints a specified number of indentation spaces.
Definition ast.cpp:3
Represents a function call in the AST.
Definition ast.h:174
void gen(Generator &) override
Generates code for this AST node.
Definition ast.cpp:94
Call()
Definition ast.h:185
Call(int id, std::shared_ptr< Node > code)
Definition ast.h:182
int conditionalCounts
Definition ast.h:180
void setId(int id)
Sets the ID of the function being called.
Definition ast.h:193
void print(int indent) override
Prints the structure of this AST node.
Definition ast.cpp:187
void setCode(std::shared_ptr< Node > code)
Sets the code block of the function being called.
Definition ast.h:202
Represents an else clause with a code block in the AST.
Definition ast.h:271
void print(int indent) override
Prints the structure of this AST node.
Definition ast.cpp:211
void gen(Generator &) override
Generates code for this AST node.
Definition ast.cpp:133
CodeElse(std::shared_ptr< Node > code)
Definition ast.h:276
Represents a contains operation in the AST.
Definition ast.h:144
void gen(Generator &) override
Generates code for this AST node.
Definition ast.cpp:62
void print(int indent) override
Prints the structure of this AST node.
Definition ast.cpp:176
The Generator class handles the generation of code and files for benchmarks.
Definition generator.h:20
Represents an identifier in the AST.
Definition ast.h:90
void gen(Generator &) override
Generates code for this AST node.
Definition ast.cpp:32
Id(std::string id)
Definition ast.h:95
void print(int indent) override
Prints the structure of this AST node.
Definition ast.cpp:156
Represents the parameters of an if statement in the AST.
Definition ast.h:252
void gen(Generator &) override
Generates code for this AST node.
Definition ast.cpp:121
void print(int indent) override
Prints the structure of this AST node.
Definition ast.cpp:204
IfParam(std::shared_ptr< Node > code, std::shared_ptr< Node > else_)
Definition ast.h:258
Represents an if statement in the AST.
Definition ast.h:234
void print(int indent) override
Prints the structure of this AST node.
Definition ast.cpp:198
void gen(Generator &) override
Generates code for this AST node.
Definition ast.cpp:117
If(std::shared_ptr< Node > ifParam)
Definition ast.h:239
Represents an insert operation in the AST.
Definition ast.h:108
void print(int indent) override
Prints the structure of this AST node.
Definition ast.cpp:161
void gen(Generator &) override
Generates code for this AST node.
Definition ast.cpp:36
Represents a lambda expression in the AST.
Definition ast.h:78
void gen(Generator &) override
Generates code for this AST node.
Definition ast.cpp:28
void print(int indent) override
Prints the structure of this AST node.
Definition ast.cpp:151
Represents a loop in the AST.
Definition ast.h:156
void print(int indent) override
Prints the structure of this AST node.
Definition ast.cpp:181
void gen(Generator &) override
Generates code for this AST node.
Definition ast.cpp:72
Loop(std::shared_ptr< Node > code)
Definition ast.h:161
Represents a new variable creation in the AST.
Definition ast.h:132
void gen(Generator &) override
Generates code for this AST node.
Definition ast.cpp:56
void print(int indent) override
Prints the structure of this AST node.
Definition ast.cpp:171
Base class for all nodes in the abstract syntax tree (AST).
Definition ast.h:35
virtual void gen(Generator &)=0
Generates code for this AST node.
virtual void print(int indent=0)=0
Prints the structure of this AST node.
Represents a remove operation in the AST.
Definition ast.h:120
void gen(Generator &) override
Generates code for this AST node.
Definition ast.cpp:46
void print(int indent) override
Prints the structure of this AST node.
Definition ast.cpp:166
Represents a sequence of operations in the AST.
Definition ast.h:216
void gen(Generator &) override
Generates code for this AST node.
Definition ast.cpp:113
Seq(std::shared_ptr< Node > code)
Definition ast.h:221
void print(int indent) override
Prints the structure of this AST node.
Definition ast.cpp:193
Represents a block of statements in the AST.
Definition ast.h:59
StatementCode(std::shared_ptr< Node > stmt, std::shared_ptr< Node > code)
Definition ast.h:65
void gen(Generator &) override
Generates code for this AST node.
Definition ast.cpp:23
void print(int) override
Prints the structure of this AST node.
Definition ast.cpp:144