Run your first RSS program

RustScript compiles RSS source into compact bytecode and executes that bytecode in pd-vm. The source extension is .rss.

Prerequisites

Install the Rust toolchain and clone the RustScript repository.

Run an existing example

cargo run -p pd-vm --bin pd-vm-run -- --fuel 100000 examples/example_complex.rss

This command is derived from the RustScript README runner invocation. The displayed program fragment is from examples/example_complex.rss and was compiled to VMBC before publication.

let mut total = 0;
for i in 0..4 {
    total = total + i;
}

let base = 7;
let add = |value| value + base;
let base = 8;
let closure_value = add(5);

let profile: Profile = {stats: {score: closure_value}};
let matched = match profile?.stats?.score {
    None => 0,
    Some(score) => if score == 12 => { closure_value } else => { 0 },
    _ => 0,
};

Continue