#ifndef BINDINGS_HPP #define BINDINGS_HPP #include #include #include class Type; typedef std::shared_ptr TypePtr; // struct containing information on the variable declaration struct DeclarationData { TypePtr type; int stack_position; }; // stores bindings for the current scope and where they are in the stack class VariableStackBindings { private: std::map bindings_; int stack_counter_; unsigned expression_stack_; public: VariableStackBindings(); void insertBinding(std::string id, TypePtr type, int32_t stack_position); void increaseStackPosition(); void resetExpressionStack(); void nextExpressionStackPosition(); int currentStackPosition() const; int stackPosition(const std::string& id) const; unsigned currentExpressionStackPosition() const; bool bindingExists(const std::string& id) const; }; #endif