Skip to content

feat: configurable grammar discovery and 0.4.1 quality gates - #27

Merged
actbit merged 5 commits into
masterfrom
agent/grammar-discovery-0.4.1
Jul 20, 2026
Merged

feat: configurable grammar discovery and 0.4.1 quality gates#27
actbit merged 5 commits into
masterfrom
agent/grammar-discovery-0.4.1

Conversation

@actbit

@actbit actbit commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • add configurable grammar node discovery with NamespaceAndTypeHierarchy, TypeHierarchy, and legacy Namespace modes
  • add [GrammarPart(typeof(Root))] for explicit cross-namespace/cross-hierarchy participation
  • honor assembly-level [assembly: Skip(...)] patterns
  • make Core grammar construction stable through snapshots, defensive RHS copies, and repeatable Build
  • remove Generator/Core type-conflict warnings and tighten nullability/test warnings
  • fix incremental model equality so Mode, skip patterns, token diagnostics, and discovery changes invalidate generation
  • make multiple [Grammar(Mode = ...)] declarations generate independently and support nodes shared by multiple grammar roots
  • prevent source hint and partial-generation collisions across namespaces and grammars
  • validate attribute identity and token constructor accessibility precisely
  • bump the package version to 0.4.1 and document the new behavior in Japanese and English
  • run the full test suite in CI and before NuGet publication with the .NET 10 SDK pinned

Why

Grammar extraction previously depended on a same-namespace scan. That prevented natural project layouts and offered no way to disable namespace-based discovery. The new modes preserve compatibility while allowing hierarchy-only or explicit discovery.

The repository also lacked a full-test quality gate before package publication, and Core builder results could retain mutable builder collections.

Impact

The default remains compatible with same-namespace grammars and additionally discovers root-derived nodes across the assembly. Users who want no namespace scan can select GrammarDiscovery.TypeHierarchy; exceptional nodes can opt in with GrammarPart.

Multiple grammar modes on the same root now emit each Lexer/Parser while sharing node partial generation safely. Nodes participating in multiple grammar roots emit one partial, while grammar-specific [OnReduce] hooks remain in the corresponding parser. Fully qualified, deterministic source hint names avoid collisions between same-named roots or nodes in different namespaces.

This is a patch release and keeps the existing Production.Rhs public API type unchanged.

Validation

  • dotnet test AstFirst.slnx -c Release --no-restore --nologo — 374 passed
  • packed AstFirst.Core, AstFirst.Runtime, and AstFirst 0.4.1 successfully
  • compatibility smoke test passed on net6.0, net8.0, and net10.0
  • git diff --check passed

Self-review

The self-review caught and fixed incremental-cache omissions, an unpinned publish SDK, stale performance/error-recovery documentation, the previously ignored assembly-level Skip attribute, source hint collisions, multiple-mode model collapsing, shared-node partial duplication, attribute-name false positives, and inaccessible token-constructor diagnostics. Invalid-signature diagnostics remain separate follow-up work.

@actbit
actbit marked this pull request as ready for review July 17, 2026 11:55
@actbit
actbit merged commit ffefda9 into master Jul 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant