Skip to main content

Module eval

Module eval 

Source
Expand description

AST node types (Expr, Op), evaluator, and number formatters.

Enums§

Base
The numeric base used when displaying integer-valued scalars.
Expr
An expression node in the AST.
FormatMode
Controls how numbers are displayed (MATLAB-compatible format modes).
Op
A binary operator used in Expr::BinOp.

Functions§

autoload_cache_insert
Inserts a function into the autoload cache. Called by exec::try_autoload.
builtin_names
Names of all built-in functions recognized by [call_builtin].
current_func_name
Returns the name of the currently executing function (top of FUNC_NAME_STACK).
eval
Evaluates an expression without file I/O context. This is the public API used by tests and non-I/O evaluation paths.
eval_with_io
Evaluates an expression with an I/O context (file descriptor table). Used by the REPL to support fopen/fclose/fgetl/fgets/fprintf(fd,...).
expr_to_string
Reconstructs a source-like string from an Expr.
format_complex
Formats a complex number re + im*i for display.
format_non_dec
Formats a number in a non-decimal integer base (hex/bin/oct). Rounds to the nearest integer before formatting.
format_number
Formats a number for display: integers without decimal point, floats with up to 10 significant fractional digits, trailing zeros trimmed. Always decimal — used for expression re-display, not user-facing output.
format_printf
Formats args using a C-style fmt string.
format_scalar
Formats a scalar f64 for user-facing output using the given base and format mode.
format_value
Formats a Value compactly: scalars as a number string, matrices as [NxM double].
format_value_full
Returns None for scalars, complex numbers, strings, and void (displayed inline or suppressed); Some(full_string) for matrices (MATLAB-style column-aligned display).
get_display_base
Returns the current numeric base stored in the thread-local context.
get_display_compact
Returns the current compact flag stored in the thread-local context.
get_display_fmt
Returns the current display format mode stored in the thread-local context.
get_last_err
Returns the last-error string.
global_declare
Declares name as global in the current scope.
global_frame_pop
Pops the top global-names frame (called on function exit by exec.rs).
global_frame_push
Pushes an empty global-names frame (called on function entry by exec.rs).
global_get
Gets a value from the shared global store.
global_init_if_absent
Initialises name in the global store to Scalar(0.0) if not already present.
global_refresh_into_env
Refreshes all names declared global in the current scope from GLOBAL_ENV into env.
global_set
Sets a value in the shared global store.
is_global
Returns true if name is declared global in the innermost active scope.
is_persistent
Returns true if name is declared persistent in the current function frame.
load_mat_file
Loads a MATLAB Level 5/7 MAT file and returns a Value::Struct.
persistent_declare
Declares name as persistent in the current function scope.
persistent_frame_pop
Pops the persistent frame and returns (func_name, declared_persistent_names).
persistent_frame_push
Pushes a function scope for persistent tracking (called on function entry).
persistent_load
Gets a saved persistent value for (func_name, var_name).
persistent_save
Saves a persistent value for (func_name, var_name).
resolve_autoloaded
Returns an autoloaded function by name, triggering the autoload hook if needed.
rng_seed
Reseeds the thread-local RNG with the given 64-bit seed.
rng_shuffle
Reseeds the thread-local RNG from OS entropy.
set_autoload_hook
Registers the autoload hook. Called by exec::init().
set_display_ctx
Sets the display context used when executing function bodies.
set_fn_call_hook
Registers the hook that executes named user-defined functions.
set_last_err
Sets the last-error string (called on every caught runtime error).
set_nargout
Sets the number of output values requested by the calling assignment statement.

Type Aliases§

AutoloadHook
Signature for the hook that auto-loads a function file by name.
FnCallHook
Signature for the hook that executes named user-defined functions.