This is the typescript based starter pack npm module to develop a parser/serializer for a language using Chevortain parser toolkit.
It bootstraps following constructs for a super simple sql dsl used in the Chevrotain Tutorial
- Lexer
- Parser
- Visitor
- Serializer
- Models
- Grammar Railroad diagram generation
- Jest based unit tests
- clone this repo
git clone https://github.com/Chevrotain/quick-start.git chevrotain-quick-start
-
Change the package name and other things as appropriate in the
package.json
-
Install dependencies
yarn install
- Start implementing your language.
Unit tests are a must when you are developing a new language. As you modify grammar, you want to make sure that new grammar is handling all use cases properly. This quick-starter comes with easy to use unit testing based on Jest.
To add tests, edit the dsl-texts.ts
file with new dsl text, model it supposed to parse into and text after
serializing using couple of format options.
To run a single test, just add only: true
property to that entry. This allows you to debug to fix issues.
Here are some resources to help with your language development
Here are some projects using Chevrotain in real world