Skip to main content

Crate dsl_kit_parse

Crate dsl_kit_parse 

Source
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 + optional source Span.
  • RawValue — per-field payload representation. Text keeps the PEG front-end’s matched source text; Json keeps the serde front-end’s typed value with no stringify round-trip.
  • check_conformance — validates a tree against a NodeSchema and 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::Grammar value.
peg
PEG grammar AST + recursive-descent interpreter (G-2).
schema_gen
Schema-driven grammar generation (item N).
serde_bridge
Serde-JSON → ParseTree bridge.

Structs§

BuildError
Non-empty diagnostic bag returned by DslBuild::from_parse_tree and check_conformance callers.
Diagnostic
One diagnostic in the unified envelope shared across parse, conformance, lint, and debugger feedback.
ParseTree
Untyped parse trunk, produced by any front-end and consumed by DslBuild.
Span
Byte-offset range into the parser input.

Enums§

Location
Where a Diagnostic points into the consumer’s material.
RawValue
Per-field payload representation carried by ParseTree.
Severity
Severity level of a Diagnostic.

Traits§

DslBuild
Contract for building a typed AST value from a validated ParseTree.

Functions§

build_child_many
Builds every child of a Multiplicity::Many slot.
build_child_one
Builds the single child of a Multiplicity::One slot.
build_child_optional
Builds the (optional) child of a Multiplicity::Optional slot.
build_field
Extracts a payload field into T.
check_conformance
Validates tree against schema shallowly (this level only).
check_conformance_with
Variant of check_conformance that routes did you mean X? hints through a caller-supplied Suggester.
field_text
Extracts a payload field’s raw text production.