Skip to main content

Module api

Module api 

Source

Structs§

CompileOptions
Options controlling compilation: VM target + conditional compilation flags.
FunctionBenchmark
Per-function benchmark comparison.
ModuleBenchmarkResult
Module-level benchmark result with per-function comparisons.
TestResult
A single test result.

Functions§

analyze_costs
analyze_costs_project
Parse, type-check, and compute cost analysis for a multi-module project. Falls back to single-file analysis if module resolution fails.
annotate_source
Parse, type-check, and produce per-line cost-annotated source output.
annotate_source_with_target
Like annotate_source, but uses the specified target’s cost model.
build_tir
Build TIR (optimized intermediate representation) from a single source file.
build_tir_project
Build TIR from a project entry point with full module resolution.
check
Type-check only (no TASM emission).
check_file_in_project
Project-aware type-check for the LSP. Finds trident.toml, resolves dependencies, and type-checks the given file with full module context. Falls back to single-file check if no project is found.
check_project
Project-aware type-check from an entry point path. Resolves all modules (including std.*) and type-checks in dependency order.
check_silent
Type-check only, without rendering diagnostics to stderr. Used by the LSP server to get structured errors.
compile
Compile a single Trident source string to TASM.
compile_module
Compile a module and emit TASM for all its functions (no linking, no DCE). Dependencies are resolved and type-checked, but only the target module’s TASM is returned. Labels use the raw __funcname: format.
compile_project
Compile a multi-module project from an entry point path.
compile_project_with_options
Compile a multi-module project with options.
compile_to_bundle
Compile a multi-module project to a ProgramBundle artifact.
compile_with_options
Compile a single Trident source string to TASM with options.
count_tasm_instructions
Count the number of TASM instructions in a compiled output string. Skips comments, labels, blank lines, and the halt instruction.
discover_tests
Discover #[test] functions in a parsed file.
fmt_num
Format a number with comma separators (e.g. 2097152 -> “2,097,152”). Returns an em-dash for zero.
fmt_ratio
Format a ratio as N.NNx using integer arithmetic. Returns an em-dash when den is zero.
format_source
Format Trident source code, preserving comments.
generate_docs
Generate markdown documentation for a Trident project.
parse_tasm_functions
Parse TASM into per-function instruction counts. Returns a BTreeMap from function name (without __ prefix) to instruction count. Only counts labeled functions; unlabeled preamble code is ignored.
run_tests
Run all #[test] functions in a project.
status_icon
Return a status icon: checkmark when num <= 2*den, warning triangle otherwise, space when den is zero.
verify_project
Parse, type-check, and verify a project using symbolic execution + solver.
verify_project_per_function
Verify all functions in a project, returning per-function results.