LSL tools: implement grammar, parser tables, precedence, and recovery #82

Closed
opened 2026-08-08 08:23:18 +00:00 by hugo · 1 comment
Owner

Objective

Re-express or faithfully port the LSL grammar/parser machine with production, precedence, shift/reduce, stack, and recovery semantics.

Deliverables

  • Choose LALRPOP only if it reproduces the fixed accepted/rejected corpus and diagnostics; otherwise generate native Rust tables matching the existing machine.
  • Preserve public parser entry points and syntax/object results.
  • Document conflicts and intentional compatibility behavior.

Validation

  • All parser/grammar/recovery tests pass exactly.
  • Representative real LSL sources round trip or parse to expected models.
  • Malformed/fuzz corpus terminates without panic or unbounded growth.

Prerequisite

All global API/test gates and the foundational/world implementations needed by these extension crates are complete.

Project constraints

  • Full native Rust implementation only; no wrapped C# parser, viewer, renderer, or service.
  • Preserve mapped APIs and exact translated tests; reuse lower layers and keep generated output deterministic.
  • Validate bounded input, callbacks/tasks, docs, coverage, and workspace gates.
## Objective Re-express or faithfully port the LSL grammar/parser machine with production, precedence, shift/reduce, stack, and recovery semantics. ## Deliverables - Choose LALRPOP only if it reproduces the fixed accepted/rejected corpus and diagnostics; otherwise generate native Rust tables matching the existing machine. - Preserve public parser entry points and syntax/object results. - Document conflicts and intentional compatibility behavior. ## Validation - All parser/grammar/recovery tests pass exactly. - Representative real LSL sources round trip or parse to expected models. - Malformed/fuzz corpus terminates without panic or unbounded growth. ## Prerequisite All global API/test gates and the foundational/world implementations needed by these extension crates are complete. ## Project constraints - Full native Rust implementation only; no wrapped C# parser, viewer, renderer, or service. - Preserve mapped APIs and exact translated tests; reuse lower layers and keep generated output deterministic. - Validate bounded input, callbacks/tasks, docs, coverage, and workspace gates.
hugo added this to the 10 - Rendering, RLV, and LSL tools milestone 2026-08-08 08:23:18 +00:00
hugo added the enhancement label 2026-08-08 08:23:18 +00:00
Author
Owner

Implemented and pushed in commit 656d837.

The LSL tools now have a fully native Rust parser runtime: validated grammar construction, canonical LR(0) cores with deterministic LALR(1) lookahead propagation, stable action/goto tables, yacc-compatible precedence and associativity conflict handling, typed parse trees, mapped parser/action/production/transition APIs, top-relative parser stack semantics, error-token recovery, structured syntax/recovery diagnostics, and explicit state/stack/step/recovery bounds. Compatibility CSymbol production registration and SymbolSet FIRST/FOLLOW state preserve shared reference behavior without unsafe code or self-referential Arc leaks. Builder-driven checked-in source generation remains explicitly assigned to #83 and returns InvalidOperation rather than false success.

Validation completed:

  • 37 package tests pass, including 10 parser fixtures for precedence, right/nonassociative behavior, epsilon productions, LALR-not-SLR lookaheads, recovery, representative LSL source, deterministic output, malformed inputs, and mapped APIs
  • strict clippy with -D warnings
  • rustdoc with -D warnings
  • standalone API compile
  • API shim regeneration check
  • issue #82 native-boundary audit: 22 types / 215 members
  • workspace all-target compile
  • formatting and diff checks

The related pre-created extension target type-checks. Its runnable YyParser constructor assertion passes; the same shared test then fails on an unrelated stale RLV constructor expectation, which is outside #82 and was left unchanged.

No C#, CLR, unsafe code, platform-only API, or runtime source generation was introduced.

Implemented and pushed in commit 656d837. The LSL tools now have a fully native Rust parser runtime: validated grammar construction, canonical LR(0) cores with deterministic LALR(1) lookahead propagation, stable action/goto tables, yacc-compatible precedence and associativity conflict handling, typed parse trees, mapped parser/action/production/transition APIs, top-relative parser stack semantics, error-token recovery, structured syntax/recovery diagnostics, and explicit state/stack/step/recovery bounds. Compatibility CSymbol production registration and SymbolSet FIRST/FOLLOW state preserve shared reference behavior without unsafe code or self-referential Arc leaks. Builder-driven checked-in source generation remains explicitly assigned to #83 and returns InvalidOperation rather than false success. Validation completed: - 37 package tests pass, including 10 parser fixtures for precedence, right/nonassociative behavior, epsilon productions, LALR-not-SLR lookaheads, recovery, representative LSL source, deterministic output, malformed inputs, and mapped APIs - strict clippy with -D warnings - rustdoc with -D warnings - standalone API compile - API shim regeneration check - issue #82 native-boundary audit: 22 types / 215 members - workspace all-target compile - formatting and diff checks The related pre-created extension target type-checks. Its runnable YyParser constructor assertion passes; the same shared test then fails on an unrelated stale RLV constructor expectation, which is outside #82 and was left unchanged. No C#, CLR, unsafe code, platform-only API, or runtime source generation was introduced.
hugo closed this issue 2026-08-11 02:46:28 +00:00
Sign in to join this conversation.