Initial layout for binder
This commit is contained in:
6
src/Binder/Binder.cpp
Normal file
6
src/Binder/Binder.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
#include "Binder.hpp"
|
||||
|
||||
BoundScriptStatement *Binder::Bind(ParsedScriptStatement *s) {
|
||||
return nullptr;
|
||||
}
|
||||
14
src/Binder/Binder.hpp
Normal file
14
src/Binder/Binder.hpp
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
#ifndef PORYGONLANG_BINDER_HPP
|
||||
#define PORYGONLANG_BINDER_HPP
|
||||
|
||||
#include "../Parser/ParsedStatements/ParsedScriptStatement.hpp"
|
||||
#include "BoundStatements/BoundStatement.hpp"
|
||||
|
||||
class Binder {
|
||||
public:
|
||||
static BoundScriptStatement* Bind(ParsedScriptStatement* s);
|
||||
};
|
||||
|
||||
|
||||
#endif //PORYGONLANG_BINDER_HPP
|
||||
49
src/Binder/BoundStatements/BoundStatement.hpp
Normal file
49
src/Binder/BoundStatements/BoundStatement.hpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include <utility>
|
||||
|
||||
|
||||
#ifndef PORYGONLANG_BOUNDSTATEMENT_HPP
|
||||
#define PORYGONLANG_BOUNDSTATEMENT_HPP
|
||||
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
enum class BoundStatementKind{
|
||||
Script,
|
||||
Block,
|
||||
};
|
||||
|
||||
class BoundStatement{
|
||||
public:
|
||||
virtual BoundStatementKind GetKind() = 0;
|
||||
virtual ~BoundStatement() = default;
|
||||
};
|
||||
|
||||
class BoundBlockStatement : public BoundStatement{
|
||||
vector<BoundStatement*> _statements;
|
||||
public:
|
||||
explicit BoundBlockStatement(vector<BoundStatement*> statements){
|
||||
_statements = std::move(statements);
|
||||
}
|
||||
~BoundBlockStatement() override {
|
||||
for (auto s : _statements){
|
||||
delete s;
|
||||
}
|
||||
_statements.clear();
|
||||
}
|
||||
|
||||
BoundStatementKind GetKind() override{
|
||||
return BoundStatementKind ::Block;
|
||||
}
|
||||
};
|
||||
|
||||
class BoundScriptStatement : public BoundBlockStatement{
|
||||
public:
|
||||
explicit BoundScriptStatement(vector<BoundStatement*> statements) : BoundBlockStatement(std::move(statements)){
|
||||
}
|
||||
|
||||
BoundStatementKind GetKind() final{
|
||||
return BoundStatementKind ::Script;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //PORYGONLANG_BOUNDSTATEMENT_HPP
|
||||
Reference in New Issue
Block a user