This backend outputs a parser as JavaScript source code. See parser generator backends for what every generated parser does and scanner generator backend: JavaScript for the scanner side.
The output is an ES module and needs nothing beyond the language itself.
--backend-javascript-scanner-module sets the module specifier the token constants are imported from, which defaults
to ./scanner.js.
Parser.parse takes a scanner and returns a result holding the tree and the errors, and can be called again with
another scanner. The tree is null when the parse could not be finished. Lexemes are a Uint8Array viewing into the
source rather than a copy of it.
examples/calculator/javascript/ is a calculator built on this backend. Its parser was generated with:
golr parser \
--frontend golr \
--frontend-file-path calculator.golr \
--backend javascript \
--backend-file-path parser/parser.js