class

Myst::Interpreter

Inherits Reference / Object

Constructors

new(input : IO = STDIN, output : IO = STDOUT, errput : IO = STDERR)
Source

Class methods

__value_from_literal(literal : Node)
Source

Instance methods

__make_type(name : String, lexical_scope : Scope | Nil, parent_type = @base_type)

Create a new, fully initialized TType object. This takes care of setting the lexical scope, inheriting from the base type and more.

Source
__raise_not_found(name, value : MTValue | Nil)
Source
__raise_runtime_error(message : String)

Raise a RuntimeError from the current location. Execution is immediataly halted and the interpreter will panic up until a rescuer is found.

Multiple overloads of this function are provided for simplicity at the call site.

Source
__raise_runtime_error(value : MTValue)
Source
__raise_runtime_error(error : RuntimeError)
Source
__scopeof(value : MTValue, prefer_instance_scope = false) : Scope

Resolve the Scope for value. For primitives, this returns the instance scope of the Type for that value. For Instances, Types, and Modules, this just returns .scope for that value.

Source
__typeof(value : MTValue)

Resolve the TType object representing the type of value. For primitive types, these are always looked up in the Kernel. For Instances, the type is looked up from the type reference on the instance itself. For Types and Modules, the value itself is returned.

Source
base_object

The true base type of every object in Myst.

Source
base_object=(base_object : TType)

The true base type of every object in Myst.

Source
base_type

The base Type for all type objects.

Source
base_type=(base_type : TType)

The base Type for all type objects.

Source
bool_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
bool_not_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
bool_to_s(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
callstack

Current stack of method calls/code blocks at any point in the interpreter.

Source
callstack=(callstack : Callstack)

Current stack of method calls/code blocks at any point in the interpreter.

Source
create_kernel
Source
current_scope
Source
current_self
Source
doc_table

A mapping of values to documentation about that value. Mostly applied to modules, types, and methods.

Source
doc_table=(doc_table : Hash(MTValue, DocComment))

A mapping of values to documentation about that value. Mostly applied to modules, types, and methods.

Source
env_assign(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
env_delete(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
env_fetch(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
env_get(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
env_keys(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
env_values(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
errput
Source
errput=(other)
Source
fd_pool

The pool of open file descriptors used to avoid duplicating entries.

Source
file_close(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
file_init(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
file_size(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_add(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_divide(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_gt(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_gte(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_lt(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_lte(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_modulo(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_multiply(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_negate(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_not_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_round(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_subtract(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_to_i(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
float_to_s(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
func_to_s(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
init_base_object
Source
init_base_type
Source
init_boolean
Source
init_env
Source
init_file(fd_type : TType)
Source
init_file_descriptor(io_type : TType)
Source
init_float
Source
init_functor
Source
init_integer
Source
init_io
Source
init_list
Source
init_map
Source
init_nil
Source
init_random
Source
init_string
Source
init_symbol
Source
init_tcp_socket(io_type)
Source
init_time
Source
init_top_level
Source
input
Source
input=(other)
Source
int_add(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
int_divide(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
int_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
int_gt(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
int_gte(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
int_lt(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
int_lte(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
int_modulo(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
int_multiply(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
int_negate(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
int_not_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
int_subtract(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
int_to_f(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
int_to_s(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
io_fd_init(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
io_fd_read(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
io_fd_write(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
io_read(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
io_write(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
kernel

The Kernel module for this instance of the interpreter.

Source
kernel=(kernel : TModule)

The Kernel module for this instance of the interpreter.

Source
list_access(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
list_access_assign(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
list_add(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
list_each(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
list_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
list_minus(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
list_not_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
list_pop(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
list_proper_subset(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
list_push(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
list_shift(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
list_size(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
list_splat(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
list_subset(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
list_unshift(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
load_dirs

The set of directories that should be considered when performing lookups with bare paths (not explicitly relative).

Source
loaded_files

A Hash of entries indicating files that have already been loaded. Entries in this Hash should always be absolute paths to avoid ambiguity between relative paths that resolve to the same file.

Source
loaded_files=(loaded_files : Hash(String, Bool))

A Hash of entries indicating files that have already been loaded. Entries in this Hash should always be absolute paths to avoid ambiguity between relative paths that resolve to the same file.

Source
lookup(node)

Lookup a value under the given name in the current scope or one of its ancestors. If the value is not found, a No variable or method RuntimeError will be raised.

Source
map_access(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
map_access_assign(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
map_add(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
map_each(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
map_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
map_not_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
map_proper_subset(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
map_size(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
map_subset(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
match(pattern : Node, value : MTValue)
Source
mt_doc(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
mt_exit(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
mt_sleep(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
nil_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
nil_not_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
nil_to_s(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
obj_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
obj_not_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
obj_to_s(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
output
Source
output=(other)
Source
passthrough_ENV_clear(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_ENV_has_key?(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_basename(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_chmod(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_delete(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_directory?(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_dirname(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_empty?(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_executable?(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_exists?(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_expand_path(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_extname(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_file?(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_read(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_readable?(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_real_path(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_rename(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
passthrough_File_size(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
passthrough_File_touch(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_writable?(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
passthrough_File_write(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
pop_callstack(to_size : Int)
Source
pop_scope_override(to_size : Int)
Source
pop_scope_override
Source
pop_self(to_size : Int)
Source
pop_self
Source
push_scope_override(scope : Scope = Scope.new)
Source
push_self(new_self : MTValue)
Source
put_error(error : RuntimeError)
Source
random_rand(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
recursive_lookup(receiver, name, check_current = true)

Attempt to lookup the given name recursively through the ancestry of the given receiver. This is mainly used for method lookup, where the simple lookup method does not search deep enough for a value.

The method will return nil if no matching entry is found.

Source
run(program, capture_errors = true)
Source
scope_override
Source
scope_stack

Stack of scopes representing the current lexical scope.

Source
scope_stack=(scope_stack : Array(Scope))

Stack of scopes representing the current lexical scope.

Source
self_stack

Value stack representing the current receiver value for operations.

Source
self_stack=(self_stack : Array(MTValue))

Value stack representing the current receiver value for operations.

Source
stack

Value stack the the interpreter uses to pass around arguments and values.

Source
stack=(stack : Array(MTValue))

Value stack the the interpreter uses to pass around arguments and values.

Source
static_File_each_line(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
static_File_join(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
static_File_lines(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
static_time_now(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
static_type_ancestors(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
static_type_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
static_type_not_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
static_type_to_s(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_add(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_at(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_chars(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_chomp(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_downcase(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_includes?(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_lstrip(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_multiply(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_not_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_reverse(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_rstrip(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_size(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_split(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_strip(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_to_f(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_to_i(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_to_s(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
string_upcase(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
symbol_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
symbol_not_eq(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
symbol_to_s(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
tcp_socket_init(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
tcp_socket_read(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
tcp_socket_write(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
time_to_s(this : MTValue, __args : Array(MTValue), block : TFunctor | Nil) : MTValue
Source
visit(node : AnonymousFunction)
Source
visit(node : And)

The result of either expression, in any case, will be the value that determined the result. i.e., in the expression true && false, the result will be false, while nil && false will result in nil.

Source
visit(node : Or)
Source
visit(node : Call)
Source
visit(node : When)
Source
visit(node : Unless)
Source
visit(node : Return)
Source
visit(node : Break)
Source
visit(node : Next)
Source
visit(node : Def)
Source
visit(node : DocComment)
Source
visit(node : ExceptionHandler)
Source
visit(node : Expressions)
Source
visit(node : Extend)
Source
visit(node : FunctionCapture)
Source
visit(node : Include)
Source
visit(node : Instantiation)
Source
visit(node : ValueInterpolation)
Source
visit(node : ListLiteral)
Source
visit(node : MapLiteral)
Source
visit(node : InterpolatedStringLiteral)
Source
visit(node : Literal)
Source
visit(node : While)
Source
visit(node : Until)
Source
visit(node : MagicConst)
Source
visit(node : Match)

Matches are syntax sugar for the creation and immediate invocation of an anonymous function. As such, they can be re-written into a Call of an AnonymousFunction node. For example: match x, y ->(true) { } ->(false) { } ->(_) { } end would be expanded to (fn ->(true) { } ->(false) { } ->(_) { } end)(x, y) which is semantically equivalent.

Source
visit(node : MatchAssign)
Source
visit(node : ModuleDef)
Source
visit(node : Nop)
Source
visit(node : OpAssign)
Source
visit(node : Raise)
Source
visit(node : Var)
Source
visit(node : IVar)
Source
visit(node : Const)
Source
visit(node : Underscore)
Source
visit(node : Require)
Source
visit(node : Self)
Source
visit(node : SimpleAssign)
Source
visit(node : TypeDef)
Source
visit(node : Negation)
Source
visit(node : Not)
Source
visit(node : Splat)
Source
visit(node : Node)
Source
visit_and_assign(node : OpAssign)
Source
visit_or_assign(node : OpAssign)
Source
warn(message : String, node : Node)
Source
warnings

The number of warnings generated by execution of programs.

Source
warnings=(warnings : Int32)

The number of warnings generated by execution of programs.

Source

Macros

__disallow_primitives(value, operation = nil)

Primitive types have some restrictions on functionality. This method will raise an appropriate error if the given value is a primitive. If operation is given, it will be used as the error message.

Source