diff --git a/src/main.cpp b/src/main.cpp index 5c51ef2..b97af9e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,6 +34,7 @@ Happy coding! */ +#include #include #include #include @@ -78,7 +79,8 @@ enum class Instructions { Getstrcharat, Getstrsize, Stoi, Stod, Tostring, Fun, Return, Endfun, Pusharg, Call, Local, - Use, Extern, Error, Catch, Try, Exception + Use, Extern, Error, Catch, Try, Exception, + Struct, Endstruct, Init }; /* @@ -96,7 +98,7 @@ enum class Instructions { See also parser function */ enum class Types { - Int, Double, String, Char, Bool, Value, Direct, Line, List, ListRef, Label, Type, Function + Int, Double, String, Char, Bool, Value, Direct, Line, List, ListRef, Label, Type, Function, Other }; // Forward declaration of Literal for list @@ -130,21 +132,8 @@ struct List { vector val; }; -/* - Literal struct - Contains literal values. For example, if the following line was written: - stdout "Hello world!" - The Literal struct in the instruction should look like this: - { - val = "Hello world!"; // I am ignoring the variant for simplicity - // of documenting the code - } - All value references are swapped out for their respective Literal they - point to. See also variables map, parser function, interpreter function -*/ -struct Literal { - variant val; -}; +// Forward definition of literal for the legendary struct struct +struct Literal; /* Direct struct @@ -161,6 +150,8 @@ struct Direct { }; struct TypeRef { + bool isCustomType = false; + string customType; Types type; }; @@ -277,6 +268,31 @@ struct Function { vector