class

Cosmo::Interpreter

Inherits Cosmo::AST::Statement::Visitor / Cosmo::AST::Expression::Visitor / Reference / Object

Constructors

new(output_ast : Bool, run_benchmarks : Bool)
Source

Instance methods

add_object_value(token : Token, object : V, key : ValueType, value : ValueType) : V forall V
Source
call_meta_method(instance : ClassInstance, operand : ValueType, name : String, op_lexeme : String, op_token : Token, return_type_override : String | Nil = nil) : ValueType
Source
declare_intrinsic(type : String, ident : String, value : ValueType, visibility = Visibility::Public) : Nil
Source
delete_meta(key : String) : Nil
Source
end_recursion(level : UInt32 = 1)
Source
evaluate(expr : Expression::Base) : ValueType
Source
execute(stmt : Statement::Base) : ValueType
Source
execute_block(block : Statement::Base, block_scope : Scope, is_fn : Bool = false) : ValueType
Source
execute_main

Check if a "main" fn exists and call it

Source
fake_ident(name : String, location : Location | Nil = nil)
Source
fake_typedef(name : String, location : Location | Nil = nil)
Source
file_path
Source
globals
Source
interpret(source : String, file_path : String) : ValueType
Source
max_recursion_depth=(max_recursion_depth : UInt32)
Source
meta
Source
resolve(expr : Expression::Base, depth : UInt32) : Nil
Source
scope
Source
set_meta(key : String, value : MetaType | Nil) : Nil
Source
start_recursion(token : Token)
Source
visit_access_expr(expr : Expression::Access) : ValueType
Source
visit_binary_op_expr(expr : Expression::BinaryOp) : ValueType
Source
visit_block_stmt(stmt : Statement::Block) : ValueType
Source
visit_break_stmt(stmt : Statement::Break) : Nil
Source
visit_case_stmt(stmt : Statement::Case) : ValueType
Source
visit_cast_expr(expr : Expression::Cast) : ValueType
Source
visit_class_def_stmt(stmt : Statement::ClassDef) : ValueType

abstract def visit_enum_def_stmt(stmt : EnumDef) : R

Source
visit_compound_assignment_expr(expr : Expression::CompoundAssignment) : ValueType
Source
visit_every_stmt(stmt : Statement::Every) : Nil
Source
visit_fn_call_expr(expr : Expression::FunctionCall) : ValueType
Source
visit_fn_def_stmt(stmt : Statement::FunctionDef) : ValueType
Source
visit_if_stmt(stmt : Statement::If) : ValueType
Source
visit_index_expr(expr : Expression::Index) : ValueType
Source
visit_is_expr(expr : Expression::Is) : Bool
Source
visit_is_in_expr(expr : Expression::IsIn) : Bool
Source
visit_lambda_expr(expr : Expression::Lambda) : ValueType
Source
visit_literal_expr(expr : Expression::Literal) : ValueType
Source
visit_multiple_assignment_expr(expr : Expression::MultipleAssignment) : Array(ValueType)
Source
visit_multiple_declaration_expr(expr : Expression::MultipleDeclaration) : Array(ValueType)
Source
visit_new_expr(expr : Expression::New) : ClassInstance
Source
visit_next_stmt(stmt : Statement::Next) : Nil
Source
visit_property_assignment_expr(expr : Expression::PropertyAssignment) : ValueType
Source
visit_range_literal_expr(expr : Expression::RangeLiteral) : RangeType
Source
visit_return_stmt(stmt : Statement::Return) : Nil
Source
visit_single_expr_stmt(stmt : Statement::SingleExpression) : ValueType
Source
visit_string_interpolation_expr(expr : Expression::StringInterpolation) : ValueType
Source
visit_table_literal_expr(expr : Expression::TableLiteral) : Hash(ValueType, ValueType)
Source
visit_ternary_op_expr(expr : Expression::TernaryOp) : ValueType
Source
visit_this_expr(expr : Expression::This) : ClassInstance
Source
visit_throw_stmt(stmt : Statement::Throw) : Nil
Source
visit_try_catch_stmt(stmt : Statement::TryCatch) : Nil
Source
visit_type_alias_expr(expr : Expression::TypeAlias) : Nil
Source
visit_type_ref_expr(expr : Expression::TypeRef) : Type
Source
visit_unary_op_expr(expr : Expression::UnaryOp) : ValueType
Source
visit_unless_stmt(stmt : Statement::Unless) : ValueType
Source
visit_until_stmt(stmt : Statement::Until) : Nil
Source
visit_use_stmt(stmt : Statement::Use) : Nil
Source
visit_var_assignment_expr(expr : Expression::VarAssignment) : ValueType
Source
visit_var_declaration_expr(expr : Expression::VarDeclaration) : ValueType
Source
visit_var_expr(expr : Expression::Var) : ValueType
Source
visit_vector_literal_expr(expr : Expression::VectorLiteral) : Array(ValueType)
Source
visit_while_stmt(stmt : Statement::While) : Nil
Source
within_fn
Source
within_fn=(within_fn : Bool)
Source