Domain, Substance, and Style parsers
Domain, Substance, and Style are all independently parsed by their own parser modules, DomainParser.ts
, SubstanceParser.ts
, and StyleParser.ts
. These files don't exist in the repo because they are generated from grammars, encoded in Domain.ne
, Substance.ne
, and Style.ne
, respectively.
We use a parser generator library, nearley.js, to write the grammars and generate parsers for them. To get started on nearley, you can read their very helpful tutorial.
When testing your parsers, yarn start
will not re-generate the parsers automatically. You need to run yarn build:parsers
to manually trigger re-generation of parsers. Since we need to generate TypeScript modules from the .ne
files, yarn build:parsers
is usually run before build scripts such as yarn build
, yarn start
, and yarn test
.
Found a problem or got a suggestion? Please open a GitHub issue and tag it with documentation
!