Files
PorygonLang/src/Binder/Binder.hpp
Deukhoofd d86e9ba8ae
All checks were successful
continuous-integration/drone/push Build is passing
Implemented generic for loops
2019-06-26 16:19:34 +02:00

61 lines
2.4 KiB
C++

#ifndef PORYGONLANG_BINDER_HPP
#define PORYGONLANG_BINDER_HPP
#include "../Parser/ParsedStatements/ParsedStatement.hpp"
#include "BoundStatements/BoundStatement.hpp"
#include "../Script.hpp"
#include "BoundVariables/BoundScope.hpp"
#include "../Parser/ParsedExpressions/ParsedTableExpression.hpp"
using namespace std;
using namespace Porygon::Parser;
namespace Porygon::Binder {
class Binder {
Porygon::Script *_scriptData;
BoundScope *_scope;
shared_ptr<FunctionScriptType> _currentFunction;
~Binder();
// Statements
BoundStatement *BindStatement(const ParsedStatement *statement);
BoundStatement *BindBlockStatement(const ParsedStatement *statement);
BoundStatement *BindExpressionStatement(const ParsedStatement *statement);
BoundStatement *BindAssignmentStatement(const ParsedStatement *statement);
BoundStatement *BindIndexAssignmentStatement(const ParsedStatement *statement);
BoundStatement *BindFunctionDeclarationStatement(const ParsedStatement *statement);
BoundStatement *BindReturnStatement(const ParsedStatement *statement);
BoundStatement *BindConditionalStatement(const ParsedStatement *statement);
BoundStatement *BindNumericalForStatement(const ParsedStatement *statement);
BoundStatement *BindGenericForStatement(const ParsedStatement *statement);
// Expressions
BoundExpression *BindExpression(const ParsedExpression *expression);
BoundExpression *BindVariableExpression(const VariableExpression *expression);
BoundExpression *BindBinaryOperator(const BinaryExpression *expression);
BoundExpression *BindUnaryOperator(const UnaryExpression *expression);
BoundExpression *BindFunctionCall(const FunctionCallExpression *expression);
BoundExpression *BindIndexExpression(const IndexExpression *expression, bool setter);
BoundExpression *BindNumericalTableExpression(const ParsedNumericalTableExpression *expression);
BoundExpression *BindTableExpression(const ParsedTableExpression *expression);
public:
static BoundScriptStatement *
Bind(Porygon::Script *script, const ParsedScriptStatement *s, BoundScope *scriptScope);
BoundExpression *BindPeriodIndexExpression(const PeriodIndexExpression *expression, bool setter);
};
}
#endif //PORYGONLANG_BINDER_HPP