Skip to content

REx v7.0

Latest

Choose a tag to compare

@GuntherRademacher GuntherRademacher released this 12 Nov 18:12
· 17 commits to main since this release
09b737a

Changes

REx 7.0 is a major release, because it changes the parsing event handler interfaces in an incompatible way. It also includes all changes of REx 6.3, released earlier today.

Breaking Changes

  • Event handlers receive codes instead of names - startNonterminal, endNonterminal, terminal and nonterminal now pass an integer id instead of the symbol name, in all target languages. Symbol.name is replaced by id. Names are available from the NONTERMINAL and TOKEN arrays of the generated parser, which are public when -tree is specified (TOKEN also with -nolexer), and from the new accessors getNonterminalName(id) and getTerminalName(id) (GetNonterminalName and GetTerminalName in Go). Codes are specific to the grammar they were generated for, and should not be stored or compared across parsers. See Migrating from Names to Codes
  • GLR ambiguity reporting - with -glr or -glalr and -ambiguity reject, the additional nonterminals ALTERNATIVE, AMBIGUOUS and UNAMBIGUOUS have the fixed codes -2, -3 and -4. They are not entries of the NONTERMINAL array, so use getNonterminalName(id) for them
  • Java -interface NAME - since such parsers share handler interfaces, getNonterminalName and getTerminalName are instance methods, Symbol.getName() takes the parser as an argument, and the standard serializers take the parser as an additional constructor argument, e.g. new XmlSerializer(writer, indent, parser)

Improvements

  • Parse tree handling without string handling - applications can dispatch on integer codes and look up names only when needed
  • Test requirements - running the tests requires a Java 21 JDK, as announced in 6.3. The test dependencies are BaseX 13.0 and Gradle 9.9.0