Brain  1.0.0
A fast esoteric language!
IfExpr.h
1 /* This is the source code of Brain Programming Language.
2  * It is licensed under GNU GPL v. 3 or later.
3  * You should have received a copy of the license in this archive (see LICENSE).
4  *
5  * Copyright Brain, 2016.
6  */
7 
8 #ifndef IF_EXPR_H
9 #define IF_EXPR_H
10 
11 #include <vector>
12 #include <iostream>
13 
14 #include <llvm/IR/IRBuilder.h>
15 #include <llvm/IR/Module.h>
16 
17 #include "Expr.h"
18 
22 class IfExpr : public Expr
23 {
24 protected:
25  std::vector<Expr *> _exprs_then;
26  std::vector<Expr *> _exprs_else;
27 public:
28  IfExpr(std::vector<Expr *> exprs_then) : _exprs_then(exprs_then) {}
29  ~IfExpr() {}
30 
31  void set_else(std::vector<Expr *> exprs_else) { _exprs_else = exprs_else; }
39  void code_gen(llvm::Module *M, llvm::IRBuilder<> &B,
40  llvm::BasicBlock *BreakBB);
47  void debug_description(int level);
52  void ast_code_gen();
56  ExpressionType expression_category();
57 };
58 
59 #endif // IF_EXPR_H
60 
Abstract class in which all expressions in Brain implement from.
Definition: Expr.h:62
void ast_code_gen()
Method for the reverse code generation from the AST. It prints out to the stdout the token itself...
Definition: IfExpr.cpp:124
void debug_description(int level)
Prints debug information when Brain&#39;s compiler has the active flags: -v | -emit-ast.
Definition: IfExpr.cpp:78
ExpressionType expression_category()
Returns the category of the expression given by the caller.
Definition: IfExpr.cpp:148
void code_gen(llvm::Module *M, llvm::IRBuilder<> &B, llvm::BasicBlock *BreakBB)
Generates the IR (Intermediate Representation) code to be executed by llvm.
Definition: IfExpr.cpp:11
Class that represents the if operator in Brain.
Definition: IfExpr.h:22