Brain  1.0.0
A fast esoteric language!
Parser Class Reference

The parser of the Brain language, it interpretes *.b, *.br or *.brain files. More...

#include <Parser.h>

Public Member Functions

 Parser (std::string source)
 Calls parse to create all expressions found in the source code. More...
 
void code_gen (llvm::Module *M, llvm::IRBuilder<> &B)
 Generates the IR (Intermediate Representation) code to be executed by llvm. More...
 
void debug_description (int level)
 Prints debug information when Brain's compiler has the active flags: -v | -emit-ast. More...
 
void ast_code_gen ()
 Method for the reverse code generation from the AST. It prints out to the stdout the token itself.
 

Protected Member Functions

void parse (std::vector< Expr * > &exprs, int level)
 It parses the Brain code. More...
 

Protected Attributes

std::string _data
 The content of the source file passed to Brain.
 
int _index
 Variable that holds the current index read by the parser.
 
std::vector< Expr * > _exprs
 

Detailed Description

The parser of the Brain language, it interpretes *.b, *.br or *.brain files.

Constructor & Destructor Documentation

Parser::Parser ( std::string  source)
inlineexplicit

Calls parse to create all expressions found in the source code.

Parameters
sourceThe source file as a string of characters. interpreter

Member Function Documentation

void Parser::code_gen ( llvm::Module *  M,
llvm::IRBuilder<> &  B 
)

Generates the IR (Intermediate Representation) code to be executed by llvm.

Parameters
MA pointer to the Brain's module.
BA reference to the Brain's IR builder.
void Parser::debug_description ( int  level)

Prints debug information when Brain's compiler has the active flags: -v | -emit-ast.

Parameters
levelThe width used to display the debug information (to mimic identation).
void Parser::parse ( std::vector< Expr * > &  exprs,
int  level 
)
protected

It parses the Brain code.

Parameters
exprsThe vector of expressions read by the constructor
level

Member Data Documentation

std::vector<Expr *> Parser::_exprs
protected

Store pointers of expressions to later call code_gen on each one of them.


The documentation for this class was generated from the following files: