Docs Grammars
NPM Github

GBNF

Grammar Parsing and Generation

import GBNF from 'gbnf' const grammar = GBNF('root ::= "foo" | "bar" | "baz"') console.log([...grammar]) // get rules