Skip to content

Release 3.7.0

Choose a tag to compare

@kaby76 kaby76 released this 26 Sep 09:50
· 103 commits to main since this release

Release 3.7.0 adds opt-in indirect left-recursion support to the interpreted parser, explicit start-rule selection, and the initial G4Plus grammar syntax.

Interpreted parsing

  • Add trparse --indirect-left-recursion for mutually/indirectly left-recursive interp grammars. Fixed-point, seed-growing evaluation reconstructs the original grammar-rule nesting in the parse tree.
  • Detect indirect left recursion when the option is absent and report an error instead of entering a nonterminating parse. The opt-in mode cannot currently be combined with context-aware lexing.
  • Add trparse --start-rule for selecting the entry rule, including interpreted parsing. Make trgen report multiple EOF-terminated start-rule candidates unless an explicit start rule is supplied; honor trgen --start-rule in that case.

G4Plus syntax

  • Add the built-in G4Plus grammar, selected automatically for .g4p and .g4+ files or explicitly with trparse -t G4Plus.
  • Unify rule syntax and remove capitalization restrictions on rule names and references. Grammar declarations determine rule kind: lexer grammar rules are lexer rules; parser and combined grammar rules are parser rules. Accept fragment syntactically in each grammar kind.
  • Add set-difference syntax, such as Identifier : IdentifierChars - (ReservedKeyword | BooleanLiteral | NullLiteral);, with an example.
  • Preserve the ability to parse existing ANTLR4 grammar syntax, including arguments, character sets, actions, and lexer commands. Add corpus compatibility tests and mixed-case rule tests.

G4Plus support in this release parses grammar source only. Generating .interp tables from G4Plus, enforcing set-difference matching, and the shared backend for additional EBNF front ends are deferred to 4.0.0.

Examples and generated tests

  • Add examples/ixml-to-antlr4/convert-ixml-to-antlr4.sh, which accepts an iXML file and writes an ANTLR4 grammar to stdout. It locates its XQuery scripts relative to itself, so it can run from another working directory; run-example.sh uses the reusable converter.
  • Update CSharp Bash and PowerShell test templates to run .trq assertions with trash xquery -q. Nonempty assertion output or an unsuccessful query makes the test fail.
  • Refresh iXML grammar formatting and remove temporary and bundled test artifacts; update the kotlin-formal test setup to specify its start rule.

Regression coverage

Add tests for indirect recursion acceptance, reconstructed trees, and rejection without the option; explicit start-rule selection and diagnostics; and G4Plus syntax and CLI integration. The G4Plus verification run passed 76 tests, including 64 existing .g4 corpus files.

Full changes: 3.6.0...3.7.0
Pull request: #728