Expand description
Writing the symbolic types out in a real language.
A backend takes a checked workspace and produces files: type declarations you can import, function skeletons to fill in, and a harness that makes a filled-in file reachable as a proof without anyone writing glue.
§What the backends share and what they do not
How a type is spelled is data — it lives in that language’s profile, along with its reserved words and its caveats. What differs between backends is how a declaration is written, because a TypeScript interface, a Python dataclass, and a Rust struct genuinely are three different things. So the spelling is shared and the declaring is not, which is roughly where the real difference between languages sits.
§Generated code has to be boring
Output is deterministic: sorted, stably ordered, no timestamps, no host names, no counters. Generating twice from an unchanged workspace produces byte-identical files. Generated code gets committed and diffed, and a file that appears to change when nothing did makes every diff worthless.
Re-exports§
pub use writer::CodeWriter;
Modules§
- literal
- Writing a value out as a literal, in a language, against its type.
- python
- Writing a universe out as Python.
- rust
- Writing a universe out as Rust.
- typescript
- Writing a universe out as TypeScript.
- writer
- Building up a file of generated code.
Structs§
- GenOptions
- What to generate.
- Generated
File - A file a backend produced.
Enums§
- GenError
- Why generation failed.
Traits§
- Backend
- A target language this can generate for.
Functions§
- backend
- The backend for a language, if this build has one.
- backends
- Every backend this build ships.
- constructors
- How a language builds the things a typed literal needs.