diff --git a/include/gp/dynamic/compiler/type/decls.hpp b/include/gp/dynamic/compiler/type/decls.hpp new file mode 100644 index 0000000..d4175f7 --- /dev/null +++ b/include/gp/dynamic/compiler/type/decls.hpp @@ -0,0 +1,5 @@ +#pragma once + +enum class gr_base_type; +struct gr_type; +struct gr_variable; diff --git a/include/gp/dynamic/compiler/type/variable.hpp b/include/gp/dynamic/compiler/type/variable.hpp new file mode 100644 index 0000000..a0b39c0 --- /dev/null +++ b/include/gp/dynamic/compiler/type/variable.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include "gp/dynamic/compiler/type/type.hpp" + + +struct gr_variable { + /// Its type. + gr_type type; + /// Register position, separate for each type (int, float, string and objects); + size_t _register = std::numeric_limits::max(); + /// Declared from the global scope ? + bool is_global; + /// Declared from an object definition ? + bool is_field; + /// Does it have a value yet ? + bool is_initialized; + /// Is the type to be infered automatically ? (e.g. the `let` keyword). + bool is_auto; + /// Can we modify its value ? + bool is_constant; + /// Its unique name inside its scope (function based scope). + string name; + /// Is the variable visible from other files ? (Global only) + bool is_public; + /// The file where the variable is declared. + size_t file_id; + /// Position information in case of errors. + size_t lex_position; +}; \ No newline at end of file