No description
Find a file
2025-08-29 16:02:22 -07:00
docs@a7035064a1 Fix handling of dynamic variables in expressions. 2025-03-29 16:25:02 -07:00
sample Fix implementation of Use; fix resolution order of As. 2025-03-24 19:13:45 -07:00
src Add auto increment variable to table; implement AddAssign operation. 2025-08-29 16:02:22 -07:00
tests Minor fixes; add foreign schema test. 2025-04-10 12:05:37 -07:00
.gitignore Prevent schema definition in subexpression. 2025-04-12 23:12:53 -07:00
.gitmodules Move documentation to separate repository. 2025-03-28 19:21:48 -07:00
Cargo.toml Update debug flags to use features. 2025-08-28 11:31:43 -07:00
LICENSE.txt Fix reparsing of result values. 2025-01-31 20:11:30 -08:00
main.suzu Add program-level data return. 2025-08-28 11:20:02 -07:00
README.md Move documentation to separate repository. 2025-03-28 19:21:48 -07:00

Suzu Environment

A compiler and runtime environment for the Suzu language.

References

Programs

Interpreter

cargo run --bin sz [file_path..]

Simple runtime to build and execute source files.

Source files are built in order, after which the entire program is executed.

If no arguments are provided, the program will build and execute main.suzu.

System Calls: print, hex, expect

Language Test Framework

cargo run --bin tests

Individually executes all files in the tests directory and reports whether an error was encountered.

System Calls: expect

Integration

As a configuration language, Suzu is intended to be integrated into host applications.

For the time being, the library may be included by adding the repository to your Rust project's Cargo.toml.

[dependencies]
suzu = { git = "https://git.tsukiyo.org/Suzu/suzu" }

Running Programs

Programs are built using load(), which may be called multiple times to expand the program.

Once the program has successfully built, its runtime may be initialized using init(), though this is automatically performed on execution.

The program is executed by calling run().

fn program(source:&str) -> Result<(),Cause>
{
    let mut program = Suzu::new();
    program.load(source)?;
    program.run()
}

Inspecting Programs

Once a program has been initialized, its global variables may be accessed.

This may be used to set variables before running or inspect results after execution.

program.init();

if let Some(object) = program.get_as::<Sequence>(&["content"]) {
    object.set_str("hello");
}

program.run()?;

if let Some(object) = program.get(&["scope", "key"]) {
    println!("{}", object.to_string());
}