class Cosmo::Interpreter
- Cosmo::Interpreter
- Reference
- Object
Included Modules
Defined in:
cosmo/runtime/interpreter.crConstructors
Instance Method Summary
- #add_object_value(token : Token, object : V, key : ValueType, value : ValueType) : V forall V
- #call_meta_method(instance : ClassInstance, operand : ValueType, name : String, op_lexeme : String, op_token : Token, return_type_override : String | Nil = nil) : ValueType
- #declare_intrinsic(type : String, ident : String, value : ValueType, visibility = Visibility::Public) : Nil
- #delete_meta(key : String) : Nil
- #end_recursion(level : UInt32 = 1)
- #evaluate(expr : Expression::Base) : ValueType
- #execute(stmt : Statement::Base) : ValueType
- #execute_block(block : Statement::Base, block_scope : Scope, is_fn : Bool = false) : ValueType
-
#execute_main : Int64 | Nil
Check if a "main" fn exists and call it
- #fake_ident(name : String, location : Location | Nil = nil)
- #fake_typedef(name : String, location : Location | Nil = nil)
- #file_path : String
- #globals : Cosmo::Scope
- #interpret(source : String, file_path : String) : ValueType
- #max_recursion_depth=(max_recursion_depth : UInt32)
- #meta : Hash(String, Cosmo::ClassInstance | String)
- #resolve(expr : Expression::Base, depth : UInt32) : Nil
- #scope : Scope
- #set_meta(key : String, value : MetaType | Nil) : Nil
- #start_recursion(token : Token)
- #visit_access_expr(expr : Expression::Access) : ValueType
- #visit_binary_op_expr(expr : Expression::BinaryOp) : ValueType
- #visit_block_stmt(stmt : Statement::Block) : ValueType
- #visit_break_stmt(stmt : Statement::Break) : Nil
- #visit_case_stmt(stmt : Statement::Case) : ValueType
- #visit_cast_expr(expr : Expression::Cast) : ValueType
-
#visit_class_def_stmt(stmt : Statement::ClassDef) : ValueType
abstract def visit_enum_def_stmt(stmt : EnumDef) : R
- #visit_compound_assignment_expr(expr : Expression::CompoundAssignment) : ValueType
- #visit_every_stmt(stmt : Statement::Every) : Nil
- #visit_fn_call_expr(expr : Expression::FunctionCall) : ValueType
- #visit_fn_def_stmt(stmt : Statement::FunctionDef) : ValueType
- #visit_if_stmt(stmt : Statement::If) : ValueType
- #visit_index_expr(expr : Expression::Index) : ValueType
- #visit_is_expr(expr : Expression::Is) : Bool
- #visit_is_in_expr(expr : Expression::IsIn) : Bool
- #visit_lambda_expr(expr : Expression::Lambda) : ValueType
- #visit_literal_expr(expr : Expression::Literal) : ValueType
- #visit_multiple_assignment_expr(expr : Expression::MultipleAssignment) : Array(ValueType)
- #visit_multiple_declaration_expr(expr : Expression::MultipleDeclaration) : Array(ValueType)
- #visit_new_expr(expr : Expression::New) : ClassInstance
- #visit_next_stmt(stmt : Statement::Next) : Nil
- #visit_property_assignment_expr(expr : Expression::PropertyAssignment) : ValueType
- #visit_range_literal_expr(expr : Expression::RangeLiteral) : RangeType
- #visit_return_stmt(stmt : Statement::Return) : Nil
- #visit_single_expr_stmt(stmt : Statement::SingleExpression) : ValueType
- #visit_string_interpolation_expr(expr : Expression::StringInterpolation) : ValueType
- #visit_table_literal_expr(expr : Expression::TableLiteral) : Hash(ValueType, ValueType)
- #visit_ternary_op_expr(expr : Expression::TernaryOp) : ValueType
- #visit_this_expr(expr : Expression::This) : ClassInstance
- #visit_throw_stmt(stmt : Statement::Throw) : Nil
- #visit_try_catch_stmt(stmt : Statement::TryCatch) : Nil
- #visit_type_alias_expr(expr : Expression::TypeAlias) : Nil
- #visit_type_ref_expr(expr : Expression::TypeRef) : Type
- #visit_unary_op_expr(expr : Expression::UnaryOp) : ValueType
- #visit_unless_stmt(stmt : Statement::Unless) : ValueType
- #visit_until_stmt(stmt : Statement::Until) : Nil
- #visit_use_stmt(stmt : Statement::Use) : Nil
- #visit_var_assignment_expr(expr : Expression::VarAssignment) : ValueType
- #visit_var_declaration_expr(expr : Expression::VarDeclaration) : ValueType
- #visit_var_expr(expr : Expression::Var) : ValueType
- #visit_vector_literal_expr(expr : Expression::VectorLiteral) : Array(ValueType)
- #visit_while_stmt(stmt : Statement::While) : Nil
- #within_fn : Bool
- #within_fn=(within_fn : Bool)
Instance methods inherited from module Cosmo::AST::Statement::Visitor(Cosmo::ValueType)
visit_block_stmt(stmt : Block) : R
visit_block_stmt,
visit_break_stmt(stmt : Break) : R
visit_break_stmt,
visit_case_stmt(stmt : Case) : R
visit_case_stmt,
visit_class_def_stmt(stmt : ClassDef) : R
visit_class_def_stmt,
visit_every_stmt(stmt : Every) : R
visit_every_stmt,
visit_fn_def_stmt(stmt : FunctionDef) : R
visit_fn_def_stmt,
visit_if_stmt(stmt : If) : R
visit_if_stmt,
visit_next_stmt(stmt : Next) : R
visit_next_stmt,
visit_return_stmt(stmt : Return) : R
visit_return_stmt,
visit_single_expr_stmt(stmt : SingleExpression) : R
visit_single_expr_stmt,
visit_throw_stmt(stmt : Throw) : R
visit_throw_stmt,
visit_try_catch_stmt(stmt : TryCatch) : R
visit_try_catch_stmt,
visit_unless_stmt(stmt : Unless) : R
visit_unless_stmt,
visit_until_stmt(stmt : Until) : R
visit_until_stmt,
visit_use_stmt(stmt : Use) : R
visit_use_stmt,
visit_while_stmt(stmt : While) : R
visit_while_stmt
Instance methods inherited from module Cosmo::AST::Expression::Visitor(Cosmo::ValueType)
visit_binary_op_expr(expr : BinaryOp) : R
visit_binary_op_expr,
visit_cast_expr(expr : Cast) : R
visit_cast_expr,
visit_fn_call_expr(expr : FunctionCall) : R
visit_fn_call_expr,
visit_is_expr(expr : Is) : R
visit_is_expr,
visit_is_in_expr(expr : IsIn) : R
visit_is_in_expr,
visit_lambda_expr(expr : Lambda) : R
visit_lambda_expr,
visit_literal_expr(expr : Literal) : R
visit_literal_expr,
visit_multiple_assignment_expr(expr : MultipleAssignment) : R
visit_multiple_assignment_expr,
visit_property_assignment_expr(expr : PropertyAssignment) : R
visit_property_assignment_expr,
visit_range_literal_expr(expr : RangeLiteral) : R
visit_range_literal_expr,
visit_string_interpolation_expr(expr : StringInterpolation) : R
visit_string_interpolation_expr,
visit_table_literal_expr(expr : TableLiteral) : R
visit_table_literal_expr,
visit_ternary_op_expr(expr : TernaryOp) : R
visit_ternary_op_expr,
visit_this_expr(expr : This) : R
visit_this_expr,
visit_type_alias_expr(expr : TypeAlias) : R
visit_type_alias_expr,
visit_type_ref_expr(expr : TypeRef) : R
visit_type_ref_expr,
visit_unary_op_expr(expr : UnaryOp) : R
visit_unary_op_expr,
visit_var_assignment_expr(expr : VarAssignment) : R
visit_var_assignment_expr,
visit_var_declaration_expr(expr : VarDeclaration) : R
visit_var_declaration_expr,
visit_var_expr(expr : Var) : R
visit_var_expr,
visit_vector_literal_expr(expr : VectorLiteral) : R
visit_vector_literal_expr
Constructor Detail
Instance Method Detail
def call_meta_method(instance : ClassInstance, operand : ValueType, name : String, op_lexeme : String, op_token : Token, return_type_override : String | Nil = nil) : ValueType
#
def declare_intrinsic(type : String, ident : String, value : ValueType, visibility = Visibility::Public) : Nil
#
Description copied from module Cosmo::AST::Statement::Visitor(Cosmo::ValueType)
abstract def visit_enum_def_stmt(stmt : EnumDef) : R