/// AUTOGENERATED COPYRIGHT HEADER START // Copyright (C) 2017-2024 Michael Fabian 'Xaymar' Dirks // AUTOGENERATED COPYRIGHT HEADER END #pragma once #include #include #include #include #include "../lexer.hpp" // BlitzBasic Built-Ins // - Include: Followed by a String, which is the file to include at this location. // - Const: Defines one or more constants, which can not be modified. // - Local: Defines one or more local variables, which can be modified. // - Global: Defines one or more global variables, which can be modified from anywhere. // - Dim: Defines a dynamically resizable array, globally accessible and modifyable. // - If, Then, ElseIf, EndIf: Your classic If. // - Select, Case, Default, End Select: Your classic Select. // - For, To, Step, Next: Your classic For loop. // - While, Wend: Your classic While loop. // - Repeat, Until, Forever: Similar to While/Wend, but the condition is at the end and will only loop if the condition is false. // - Exit: Exit from any currently active loops. I guess this allows leaving Repeat/Forever combinations. // - True, False: True and False. What, did you expect something else? // - Stop: Pause the program for the debugger, if there happens to be one. // - End: Terminate the program. // - Goto: Jump to a specific label, without setting the return address. // - Gosub, Return: Jump to a specific label (subroutine), setting the return address appropriately, and Return from it eventually. // - Function, Return, End Function: Defines a function, and allows returning values. Yes, I know, End itself terminates the program, this is a special case. Thanks younger Sibly. // - And, Or, Not: Logical operator, self-explanatory really. namespace blitz { namespace ast { class expression { public: virtual ~expression() = default; }; // Values class value_expression : public expression { protected: blitz::token _token; public: virtual ~value_expression() = default; value_expression(blitz::token token); }; class integer_expression : public value_expression { protected: int32_t _value; public: virtual ~integer_expression() = default; integer_expression(blitz::token token); }; class real_expression : public value_expression { protected: float _value; public: virtual ~real_expression() = default; real_expression(blitz::token token); }; class string_expression : public value_expression { std::string _value; public: virtual ~string_expression() = default; string_expression(blitz::token token); }; /** One or more constant values * * Const var = Value, var2 = value */ class const_expression : public expression { std::list> _values; }; /** One or more local variables * * Local var, var2 = value, var3 */ class local_expression : public expression { std::list> _values; }; /** One or more global variables * * Local var, var2 = value, var3 */ class global_expression : public expression { std::list> _values; }; /** A variable definition * * */ class variable_expression : public expression { blitz::token _assign; std::string _name; std::shared_ptr _value; public: virtual ~variable_expression() = default; variable_expression(blitz::token token); }; } // namespace ast } // namespace blitz