Skip to main content

Crate sage_codegen

Crate sage_codegen 

Source
Expand description

Code generator for compiling Sage to Rust.

This crate transforms a type-checked Sage AST into Rust source code that can be compiled with rustc via Cargo.

§Example

use sage_codegen::Codegen;
use sage_parser::Program;

let program: Program = /* parse and check */;
let rust_code = Codegen::generate(&program);

Structs§

CodegenConfig
Full configuration for code generation.
GeneratedProject
Generated Rust project files.
GeneratedTestProject
Generated test project files (RFC-0012).
ObservabilityConfig
Observability configuration for tracing and metrics.

Enums§

PersistenceBackend
Persistence backend configuration for @persistent fields.
RuntimeDep
How to specify the sage-runtime dependency in generated Cargo.toml.

Functions§

generate
Generate Rust code from a Sage program (single file).
generate_module_tree
Generate Rust code from a module tree (multi-file project).
generate_module_tree_with_config
Generate Rust code from a module tree with custom runtime dependency.
generate_module_tree_with_full_config
Generate Rust code from a module tree with full configuration.
generate_test_program
Generate a test binary from a Sage test file (RFC-0012).
generate_test_program_with_config
Generate a test binary with custom runtime dependency.
generate_with_config
Generate Rust code from a Sage program with custom runtime dependency.
generate_with_full_config
Generate Rust code from a Sage program with full configuration.