Skip to content

Release 4.0.0 - #729

Merged
kaby76 merged 22 commits into
mainfrom
trash-release-4.0.0
Sep 30, 2026
Merged

kaby76 merged 22 commits into
mainfrom
trash-release-4.0.0

Conversation

@kaby76

@kaby76 kaby76 commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Release 4.0.0 expands Trash's interpreted-parser pipeline beyond ANTLR4. The shared grammar front-end and binding layer lowers several grammar notations into the existing ATN compiler, producing .interp and .tokens files that dotnet trash parse --allstar can run without a generated target-language parser.

Highlights

  • Add experimental G4X (.g4x) interpretation. Lexer versus parser rule kind follows the grammar declaration rather than rule-name capitalization; the front end binds vocabularies, handles start-rule selection, and diagnoses unsupported constructs.
  • Add documented basic front ends for REx, scannerless iXML, ABNF, Bison, and W3C EBNF. ABNF, iXML, and W3C EBNF use character-level lexing; Bison productions use a separately supplied ANTLR4 or G4X lexer.
  • Replace the old XPath-based implementations of trcombine and trrename with XQuery4 transformations, preserving unrelated bundle members. The trrename regression script now runs under both MSYS2 and Linux.
  • Add XQuery4 examples for sorting REx and ANTLR4 productions, including EOF-terminated start rules, and for structurally converting Tree-sitter grammar.json files to W3C EBNF.
  • Update the introduction, command documentation, examples, tests, and 4.0.0 version metadata; refresh bundled grammar sources and test dependencies.

Coverage and limitations

These new front ends implement documented subsets, not full conformance. iXML produces Trash parse trees rather than iXML's prescribed XML output. G4X set difference and scannerless parser character sets are not compiled yet; arbitrary target-language actions and predicates are not executed. The Tree-sitter conversion is intentionally lossy and marks untranslatable regexes and constructs with undefined symbols. See each example's README for its supported subset.

Validation

Added unit and runnable integration coverage for the new front ends and transformation examples. The W3C EBNF front end passed its 10 focused tests, 33 neighboring front-end regression tests, and its end-to-end example; the Tree-sitter conversion example also reparses its sample output as W3C EBNF.

@kaby76
kaby76 marked this pull request as ready for review September 26, 2026 13:33
Copilot AI lite review requested due to automatic review settings September 26, 2026 13:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Resolve the Unicode handling and version metadata issues; also ensure the new tests run in CI.

Review effort: Lite
Findings: 2 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Release 4.0.0 adds G4Plus and basic REx grammar interpretation to trinterp, with shared lowering, binding, diagnostics, tests, and examples.

Changes:

  • Adds G4Plus/REx frontends and GrammarNode representations.
  • Refactors ATN generation and grammar binding.
  • Adds integration tests and runnable examples.

Review findings:

  • src/trinterp/RexFrontend.cs: Moderate issue with supplementary Unicode characters (3 votes).
  • src/trinterp/readme.md: Moderate version metadata inconsistency (2 votes).
  • tests/AllStarParserTests/AllStarParserTests.csproj: Nit regarding CI test discovery (2 votes).
File Description
tests/​AllStarParserTests/​RexInterpTests.cs Adds REx interpolation tests.
tests/​AllStarParserTests/​G4PlusInterpTests.cs Adds G4Plus CLI and ATN tests.
tests/​AllStarParserTests/​AllStarParserTests.csproj References trinterp.
src/​trinterp/​trinterp.csproj Removes unused XQuery references.
src/​trinterp/​RexFrontend.cs Adds REx lowering.
src/​trinterp/​readme.md Documents new frontends.
src/​trinterp/​ParserAtnFactory.cs Uses GrammarNode.
src/​trinterp/​LexerAtnFactory.cs Uses GrammarNode.
src/​trinterp/​GrammarParser.cs Adds frontend dispatch and rule classification.
src/​trinterp/​GrammarNode.cs Adds owned syntax representation.
src/​trinterp/​GrammarModel.cs Adds rule and grammar metadata.
src/​trinterp/​GrammarFrontend.cs Adds frontend abstraction.
src/​trinterp/​GrammarBinding.cs Adds vocabulary binding and validation.
src/​trinterp/​G4PlusFrontend.cs Adds G4Plus lowering.
src/​trinterp/​Command.cs Integrates validation and diagnostics.
src/​grammars/​g4plus/​readme.md Documents table generation.
examples/​rex-interp/​run-example.sh Adds REx example runner.
examples/​rex-interp/​README.md Documents the REx example.
examples/​rex-interp/​List.rex Adds REx list grammar.
examples/​rex-interp/​Arithmetic.rex Adds REx arithmetic grammar.
examples/​rex-interp/​.gitignore Ignores generated files.
examples/​README.md Registers new examples.
examples/​g4plus-interp/​run-example.sh Adds G4Plus example runner.
examples/​g4plus-interp/​README.md Documents the G4Plus example.
examples/​g4plus-interp/​input.txt Provides example input.
examples/​g4plus-interp/​ArithmeticParser.g4p Adds parser grammar.
examples/​g4plus-interp/​ArithmeticLexer.g4p Adds lexer grammar.
examples/​g4plus-interp/​.gitignore Ignores generated files.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/trinterp/RexFrontend.cs
Comment thread src/trinterp/readme.md

<ItemGroup>
<ProjectReference Include="../../src/trparse/trparse.csproj" />
<ProjectReference Include="../../src/trinterp/trinterp.csproj" />

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved critical release-publishing and moderate interpreter correctness issues block approval.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open (3)
Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Rejects required EOF=-1 token vocabulary entry

src/​trinterp/​GrammarBinding.cs:97

Standard ANTLR .tokens files include the required EOF=-1 entry (for example tests/grammars-v4/acme/interp/acme.tokens:1), but this condition rejects every non-positive type before reading the name. A parser that relies on a sidecar token vocabulary will therefore fail binding even when the vocabulary is valid; allow exactly EOF=-1 while continuing to reject other invalid types.

Comment thread scripts/set-version.sh
kaby76 and others added 17 commits September 27, 2026 09:40
---
updated-dependencies:
- dependency-name: coverlet.collector
  dependency-version: 10.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: coverlet.collector
  dependency-version: 10.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: coverlet.collector
  dependency-version: 10.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
…serTests/main/multi-0883d7587e

Bump coverlet.collector from 6.0.4 to 10.1.0
@kaby76
kaby76 merged commit b9a26c7 into main Sep 30, 2026
1 check 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.

2 participants