Expand description
Parser trunk for dsl-kit DSLs.
Two front-ends (serde bridge in G-1b, PEG interpreter in G-2) will
both feed a single ParseTree shape. One consumer,
#[derive(DslBuild)] (G-1c), converts a validated tree into a
typed AST value using the caller’s IdGen to mint fresh
NodeIds.
This module (G-1a) lands the central data types and the schema
conformance checker that both front-ends run against. All feedback
flows through one Diagnostic envelope so the consumer AI sees a
single dialect across parsing, conformance, lint, and debugger.
§Architecture (layers)
ParseTree— untyped trunk. Variant name + field payloads + named child slots (positional lists, plus keyed entries forMultiplicity::Mapslots) + optional sourceSpan.RawValue— per-field payload representation.Textkeeps the PEG front-end’s matched source text;Jsonkeeps the serde front-end’s typed value with no stringify round-trip.check_conformance— validates a tree against aNodeSchemaand returns diagnostics.Diagnostic/Severity/Location— the shared envelope shape.DslBuild— trait consumed by the derive to build a typed AST.BuildError— non-empty diagnostic bag returned on build failure.
Modules§
- codes
- Diagnostic codes emitted by
check_conformance. - example_
gen - Example synthesis from a grammar (item Q-1).
- grammar_
check - Static grammar checks (G-3) for a
crate::peg::Grammarvalue. - peg
- PEG grammar AST + recursive-descent interpreter (G-2).
- schema_
gen - Schema-driven grammar generation (item N).
- serde_
bridge - Serde-JSON →
ParseTreebridge.
Structs§
- Build
Error - Non-empty diagnostic bag returned by
DslBuild::from_parse_treeandcheck_conformancecallers. - Diagnostic
- One diagnostic in the unified envelope shared across parse, conformance, lint, and debugger feedback.
- Parse
Tree - Untyped parse trunk, produced by any front-end and consumed by
DslBuild. - Span
- Byte-offset range into the parser input.
Enums§
- Location
- Where a
Diagnosticpoints into the consumer’s material. - RawValue
- Per-field payload representation carried by
ParseTree. - Severity
- Severity level of a
Diagnostic.
Traits§
Functions§
- build_
child_ many - Builds every child of a
Multiplicity::Manyslot. - build_
child_ map - Builds every entry of a
Multiplicity::Mapslot into aBTreeMapkeyed by the front-end’s keys. - build_
child_ one - Builds the single child of a
Multiplicity::Oneslot. - build_
child_ optional - Builds the (optional) child of a
Multiplicity::Optionalslot. - build_
field - Extracts a payload field into
T. - build_
field_ optional - Extracts an optional payload field into
Option<T>. - build_
field_ vec - Extracts a payload field into
Vec<T>. - check_
conformance - Validates
treeagainstschemashallowly (this level only). - check_
conformance_ with - Variant of
check_conformancethat routesdid you mean X?hints through a caller-suppliedSuggester. - field_
text - Extracts a payload field’s raw text production.