Brain  1.0.0
A fast esoteric language!
ArithmeticExpr.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 ARITHMETIC_EXPR_H
9 #define ARITHMETIC_EXPR_H
10 
11 #include <llvm/IR/IRBuilder.h>
12 #include <llvm/IR/Module.h>
13 
14 #include <iostream>
15 #include <string>
16 
17 #include "Expr.h"
18 
23 typedef enum
24 {
25  AT_MUL,
26  AT_DIV,
27  AT_REM
28 } ArithmeticType;
29 
34 class ArithmeticExpr : public Expr
35 {
36 protected:
37  ArithmeticType _type;
38  std::string type_to_string();
39 public:
40  ArithmeticExpr(ArithmeticType type) : _type(type) {}
41  ~ArithmeticExpr() {}
49  void code_gen(llvm::Module *M, llvm::IRBuilder<> &B,
50  llvm::BasicBlock *BreakBB);
57  void debug_description(int level);
62  void ast_code_gen();
63 };
64 
65 #endif // ARITHMETIC_EXPR_H
Abstract class in which all expressions in Brain implement from.
Definition: Expr.h:62
void code_gen(llvm::Module *M, llvm::IRBuilder<> &B, llvm::BasicBlock *BreakBB)
Generates the IR (Intermediate Representation) code to be executed by llvm.
Definition: ArithmeticExpr.cpp:12
void ast_code_gen()
Method for the reverse code generation from the AST. It prints out to the stdout the token itself...
Definition: ArithmeticExpr.cpp:61
Represents the three arithmetic operations that you can use and abuse in Brain.
Definition: ArithmeticExpr.h:34
void debug_description(int level)
Prints debug information when Brain&#39;s compiler has the active flags: -v | -emit-ast.
Definition: ArithmeticExpr.cpp:48