Expand description
Canonical normalizer — converts ICL to deterministic canonical form
The normalizer transforms an ICL contract into its canonical representation. This is the single deterministic form used for hashing, comparison, and storage.
§Pipeline
ICL text → parse → AST → normalize_ast → serialize_canonical → SHA-256
§Guarantees
- Idempotent:
normalize(normalize(x)) == normalize(x) - Deterministic: same input always produces same output
- Unique: each distinct contract has one canonical form
- Semantic preserving: no information loss
Functions§
- compute_
semantic_ hash - Compute SHA-256 semantic hash of a normalized AST
- normalize
- Normalize ICL text to canonical form
- normalize_
ast - Normalize a parsed AST to canonical form (sorted, expanded, hashed)
- normalize_
contract - Normalize a parsed Contract struct to canonical form
- serialize_
canonical - Serialize a ContractNode AST to canonical ICL text