19 std::vector<AST::StmtPtr>&
stmts;
59 std::vector<AST::Argument>
args;
60 std::vector<AST::StmtPtr>
block;
64 std::map<std::string, std::vector<std::shared_ptr<FunctionInfo>>>
functions;
78 std::map<std::string, std::pair<AST::AccessModifier, ModuleInfo*>>
modules;
79 std::map<std::string, std::pair<AST::AccessModifier, std::string>>
functions;
82 std::map<std::string, ModuleInfo*>
modules;
103 std::filesystem::path file_path = std::filesystem::absolute(fn);
129 std::map<std::string, std::vector<std::shared_ptr<FunctionInfo>>>
get_functions()
const {
Header file for defining AST tree elements.
Binary expression container.
Chain of objects expression container.
Statement of do-while cycle.
Base class of expression.
Statement of extern calls.
Function calling expression container.
Statement of functions calling.
Statement of functions declaration.
Statement of control flow operator.
Statement of module definition.
Unary expression container.
Statement of import the module.
Statement of assignment of variable.
Statement of variable declaration.
Variable expression container.
Statement of while cycle.
Value * get_function_return_value_from_do_while_cycle(AST::DoWhileCycleStmt &dwcs)
Method for evaluating and returning function returned value from do-while cycle.
std::string get_mangled_name(std::string base_name)
Method for getting mangled name.
Value implicitly_cast(Value val, AST::Type type, uint32_t line)
Method for getting implicitly casted value between two values.
void analyze_break_stmt(AST::BreakStmt &bs)
Method for analyze break statement.
void analyze_return_stmt(AST::ReturnStmt &rs)
Method for analyze 'return' statement.
SemanticAnalyzer(std::vector< AST::StmtPtr > &s, std::string lp, std::string fn, bool id)
Value analyze_unary_expr(AST::UnaryExpr &ue)
Method for analyze unary expression.
std::map< AST::TypeValue, std::vector< AST::TypeValue > > implicitly_cast_allowed_types
void analyze()
Method for analyze all statements.
Value * get_function_return_value_from_for_cycle(AST::ForCycleStmt &fcs)
Method for evaluating and returning function returned value from for cycle.
AST::Value get_default_val_by_type(AST::Type type, uint32_t line)
Method for getting default value by type.
std::map< std::string, ModuleInfo * > modules
std::vector< AST::StmtPtr > & stmts
Value analyze_obj_chain_expr(AST::ChainObjects &co)
Method for analyze chain of objects expression.
void analyze_if_else_stmt(AST::IfElseStmt &ies)
Method for analyze control flow operators.
void analyze_func_decl_stmt(AST::FuncDeclStmt &fds)
Method for analyze function declaration.
void analyze_var_decl_stmt(AST::VarDeclStmt &vds, bool is_func_arg=false)
Method for analyze variable declaration.
std::vector< std::string > allowed_langs_for_extern
void analyze_var_asgn_stmt(AST::VarAsgnStmt &vas)
Method for analyze variable assignment.
std::string path_to_current_dir
void analyze_use_module_stmt(AST::UseModuleStmt &ums)
Method for analyze import the module.
std::unique_ptr< Value > get_variable_value(std::string name)
Method for getting value of variable from view scope of variables table.
std::map< std::string, ModuleInfo * > get_modules() const
Method for getting modules from semantic.
AST::Type get_common_type(AST::Type left, AST::Type right, uint32_t line)
Method for getting common type between two types.
void analyze_extern_stmt(AST::ExternStmt &es)
Method for analyze extern calls.
Value analyze_func_call_expr(AST::FuncCallExpr &fce)
Method for analyze function calling expression.
std::vector< std::shared_ptr< FunctionInfo > > get_function_candidates(std::string name)
Method for getting function candidates from functions table.
std::map< std::string, std::vector< std::shared_ptr< FunctionInfo > > > functions
Value analyze_expr(AST::Expr &expr)
Method for analyze expression.
bool has_common_type(AST::Type left, AST::Type right)
Method for determining whether two types have a common type.
void analyze_do_while_cycle_stmt(AST::DoWhileCycleStmt &dwcs)
Method for analyze do-while cycle.
void analyze_while_cycle_stmt(AST::WhileCycleStmt &wcs)
Method for analyze while cycle.
double binary_two_variants(Value left, Value right, TokenType op, uint32_t line)
Method for evaluating binary operations on two values from std::variant.
Value get_function_return_value(std::shared_ptr< FunctionInfo > func, AST::FuncCallExpr &fce)
Method for evaluating and returning function returned value.
std::stack< PathPart > current_path
void analyze_continue_stmt(AST::ContinueStmt &cs)
Method for analyze continue statement.
void analyze_stmt(AST::Stmt &stmt)
Method for analyze one statement.
Value analyze_literal_expr(AST::Literal &lit)
Method for analyze literal.
std::vector< std::string > names_of_imported_modules
void analyze_for_cycle_stmt(AST::ForCycleStmt &fcs)
Method for analyze for cycle.
Value * get_function_return_value_from_while_cycle(AST::WhileCycleStmt &wcs)
Method for evaluating and returning function returned value from while cycle.
Space
Current space (in global, in module or in function).
void analyze_module_stmt(AST::ModuleStmt &ms)
Method for analyze module definition.
std::map< std::string, std::vector< std::shared_ptr< FunctionInfo > > > get_functions() const
Method for getting functions from semantic.
enum SemanticAnalyzer::Space current_space
std::vector< PathPart > get_resolved_name(std::string mangled_name)
Method for getting resolved name by mangled name.
void analyze_func_call_stmt(AST::FuncCallStmt &fcs)
Method for analyze function calling.
Value analyze_obj_from_chain(Value target, AST::Expr &obj)
Method for analyze object from chain of objects expression.
std::stack< std::map< std::string, Value > > variables
Value * get_function_return_value_from_if_else(AST::IfElseStmt &ies)
Method for evaluating and returning function returned value from control flow operators.
double unary_two_variants(Value value, TokenType op, uint32_t line)
Method for evaluating unary operations on two values from std::variant.
Value analyze_binary_expr(AST::BinaryExpr &be)
Method for analyze binary expression.
Value analyze_var_expr(AST::VarExpr &ve)
Method for analyze variable expression.
std::stack< AST::Type > functions_ret_types
Structure for describing the type.
Structure for describing the value.
std::vector< AST::StmtPtr > block
std::vector< AST::Argument > args
FunctionInfo(AST::Type rt, std::vector< AST::Argument > a, std::vector< AST::StmtPtr > b)
Structure of information about module.
std::map< std::string, std::pair< AST::AccessModifier, ModuleInfo * > > modules
std::map< std::string, std::pair< AST::AccessModifier, std::string > > functions
Structure of part of path to object.
Object
Object from path (module or class).
enum SemanticAnalyzer::PathPart::Object object
Value(AST::Type t, AST::Value v, bool vu, bool il)
TokenType
All tokens types.