Skip to main content

Crate virtual_rust

Crate virtual_rust 

Source
Expand description

§Virtual Rust

A tree-walking interpreter that runs Rust source code directly without compilation. Supports variables, functions, closures, control flow, structs, arrays/Vec, match expressions, and more.

§Quick start

// Run a Rust source file
virtual_rust::run_source(r#"
    fn main() {
        println!("Hello from Virtual Rust!");
    }
"#).unwrap();

Modules§

ast
Abstract Syntax Tree (AST) types for the VirtualRust interpreter.
cargo_runner
Compiles and runs Rust source files that declare external dependencies, or runs existing Cargo projects directly.
interpreter
Tree-walking interpreter for the Virtual Rust VM.
lexer
Lexical analyzer that transforms Rust source code into a stream of tokens.
parser
Recursive-descent parser that transforms a token stream into an AST.
token
Token definitions for the Rust subset supported by VirtualRust.

Functions§

eval_source
Runs Rust source code and returns the final result as a display string.
run_source
Runs Rust source code directly without compilation.