A small PEG based parser library.
An opinionated JavaScript port of Parslet.
npm install --save parsly
// There is 2 ways to access Parsly APIs.
// Parser API:
import {Parser} from 'parsly'
import {alt, seq, match, str, any, custom, lazy} from 'parsly/parser'
// Transform API:
import {Transformer} from 'parsly'
import Transformer, {simple, sequence, subtree} from 'parsly/transformer'
alt(...parsers)
seq(...parsers)
match(expr)
str(string)
any()
custom(fn)
lazy(fn)
as(name)
maybe()
many()
times(n)
repeat(min, max)
Transform
Node
simple(node)
sequence(node)
subtree(node)
Transform(rules)
Transform#rule(matchFn, transformFn)
Transform#run(ast, context)