This backend outputs a scanner as Java source code. See scanner generator backends for what every generated scanner does and parser generator backend: Java for the parser side.
It targets Java 17.
--backend-java-package-name sets the package the file declares, which defaults to parser.
The scanner is the Scanner class, its tokens are the nested Scanner.Token enum, and the nested
Scanner.TokenSkipper wraps a scanner to drop the tokens marked for skipping. Both implement TokenSource, which is
what a parser reads its tokens through. Lexemes are a ByteBuffer over the source rather than a copy of it.
examples/calculator/java/ is a calculator built on this backend. Its scanner was generated with:
golr scanner \
--frontend golr \
--frontend-file-path calculator.golr \
--backend java \
--backend-file-path parser/Scanner.java