Expand description
M2: canonical AST, node IDs, canonicalizer, canonical-JSON, hashing.
See spec §5.
Re-exports§
pub use canonicalize::canonicalize_program;pub use canonicalize::canonicalize_item;pub use canon_print::print_example;pub use canon_print::print_stages;pub use ids::collect_ids;pub use ids::expr_ids;pub use ids::NodeId;pub use ids::NodeRef;pub use patch::apply_patch;pub use patch::Patch;pub use patch::PatchError;pub use transforms::extract_function;pub use transforms::inline_let;pub use transforms::rename_local;pub use transforms::replace_match_arm;pub use transforms::ExtractFnSpec;pub use transforms::TransformError;pub use canonical::*;
Modules§
- canon_
json - Canonical JSON encoding (RFC 8785-flavored).
- canon_
print - Pretty-printer for canonical AST. Output is parseable Lex source.
- canonical
- Canonical AST per spec §5.1.
- canonical_
format - Stable binary canonical-AST format for Lex programs (#206).
- canonicalize
- Canonicalizer:
SyntaxTree→CanonicalAstper spec §5.3. - dead_
branch - Dead-branch elimination on the canonical AST (#228).
- ids
- Node IDs (§5.2). A NodeId encodes the path from a stage root to a node
as
n_0[.<i>]*, where each<i>is the position in the parent’s children array. - patch
- Canonical-AST patches per spec §5.4.
- transforms
- Typed, valid-by-construction AST transforms (#280).
Functions§
- implementation_
hash - SHA-256 over the canonical AST with the name fields blanked out.
Two implementations that differ only in their function/type name
produce the same
implementation_hash(and therefore the same StageId, given matching SigIds). - sig_id
- SigId: §4.1. SHA-256 over canonical_json({name, input_types, output_type, effects}).
- stage_
canonical_ hash - SHA-256 over the canonical-JSON encoding of a stage. Excludes NodeIds (the canonical AST data does not carry IDs; they’re derived).
- stage_
canonical_ hash_ hex - stage_
id - StageId: §4.1, with §4.6 default applied.