Overview
gerc sits between parc, linc, and downstream Rust tooling in the
toolchain:
PARC (source contracts)
-> LINC (link and evidence contracts)
-> GERC (Rust lowering and emission)
-> generated Rust bindings crate or source bundle
Read this chapter as the workflow summary:
gercreceives its own input model- any upstream artifact translation happens outside
gerc/src/** gercgates, lowers, and emits deterministic Rust and build artifacts
What Happens Inside GERC
-
Intake -
gercreceives aGercInputwrapping source plus optional evidence. Tests/examples or external harnesses may translate PARC and LINC artifacts into that model. -
Safety gating - Each declaration is checked against generation rules. Items that cannot be safely represented in Rust are rejected with diagnostics rather than guessed into existence.
-
Lowering - Accepted declarations are lowered from the crate-owned C-side model into
RustProjection. -
Type mapping - C types, pointers, arrays, function pointers, and qualifiers are mapped to Rust FFI-safe equivalents.
-
Emission - The projection is rendered into deterministic Rust source. Items are emitted in a stable order: constants, type aliases, enums, records, then
extern "C"declarations. -
Crate generation - Optionally,
gercwrites a Cargo-compatible crate directory or a source bundle plusrustclink arguments.
Design Principles
- Deterministic - the same input always produces the same output
- Conservative - refuse generation rather than emit unsound code
- Library-first -
gercis a Rust library, not a CLI tool - Generic - no
fol-specific assumptions in the core crate - Artifact-boundary integration - cross-package composition belongs outside
gerc/src/** - No back-compat burden - discarded shapes are deleted, not preserved