Compiler API Reference¶
API documentation for the USL compiler.
Command Line Interface¶
Compile¶
Options: - --verify=[none|basic|full] - Verification level (default: full) - --incremental - Enable incremental compilation - --jobs=N - Parallel compilation threads - --verbose - Verbose output - --output=DIR - Output directory
Example:
Generate¶
Targets: - typescript - TypeScript/Node.js - rust - Rust - python - Python - openapi - OpenAPI specification
Options: - --output=DIR - Output directory - --optimize - Enable optimizations - --tree-shake - Remove unused code
Example:
Test¶
Options: - --filter=PATTERN - Run matching tests - --verbose - Show test details
Verify¶
Runs formal verification without code generation.
Programmatic API¶
Rust¶
use usl_compiler::{Compiler, CompilerOptions};
let options = CompilerOptions {
verify: VerificationLevel::Full,
incremental: true,
..Default::default()
};
let compiler = Compiler::new(options);
let result = compiler.compile_file("my-app.usl")?;
TypeScript¶
import { Compiler, CompilerOptions } from '@usl-lang/compiler';
const options: CompilerOptions = {
verify: 'full',
incremental: true,
};
const compiler = new Compiler(options);
const result = await compiler.compileFile('my-app.usl');
Configuration File¶
usl.toml: