@tabnas/abnf
v0.2.2
Published
ABNF grammar compiler for the tabnas parser.
Maintainers
Readme
@tabnas/abnf
ABNF grammar compiler for the
tabnas parser.
Takes ABNF source (the RFC 5234 dialect — = and /, not ::=) and
emits a tabnas GrammarSpec. Installed on an engine, the spec parses
inputs in that grammar and builds a {rule, src, kids} AST. It can also
emit "pure-data" jsonic and supports user actions. Ships the
tabnas-abnf CLI.
Install
npm install @tabnas/parser @tabnas/abnfUse
const { Tabnas } = require('@tabnas/parser')
const { abnf } = require('@tabnas/abnf')
const tn = new Tabnas({ plugins: [abnf] })
tn.abnf(`greet = "hi" / "hello"`)
tn.parse('hi') // => ({ rule: 'greet', src: 'hi', kids: [] })Documentation
Four-quadrant Diátaxis docs:
- tutorial.md — learning-oriented: zero to a working parser, step by step.
- guide.md — task-oriented recipes for real problems.
- reference.md — the exact API surface and CLI flags.
- concepts.md — how the compiler works and why.
CLI
tabnas-abnf -f grammar.abnf
tabnas-abnf 'g = "a"' --parse 'a'
tabnas-abnf -C 'greet = "hi"' # compile to pure-data jsonicLicense
MIT. Copyright (c) Richard Rodger.
