nearley
nearley copied to clipboard
Allow the user to pick an output language
I would like to be able to use the cli to generate typescript output. This change adds an optional language flag to specify which of the existing generators might be used.
Just use @preprocessor in your grammar file.
For example: @preprocessor typescript at the beginning of your grammar file lets you use typescript in your post-processors and generates typescript for you.
@preprocessor also supports coffeescript.
Awesome. Thank you for the answer. That took a bit of digging to find in the docs. https://nearley.js.org/docs/parser#using-preprocessors