terrario
v0.11.0
Published
A refined, expressive parser combinator library.
Downloads
35
Maintainers
Readme
A refined, expressive parser combinator library. Try it out!
- 📍 Minimal yet powerful APIs
- 🖨 Scannerless parsing
- ⚙ Supports conditional control by state
- ✨ Zero dependency
The Terrario is inspired by PEG.js, Parsimmon, etc.
Installation
npm i terrario
Documentation
See Website
Basic Example
import * as T from 'terrario';
// build a parser
const parser = T.alt([
T.str('hello'),
T.str('world'),
T.str(' '),
]).many();
// parse the input string
const input = 'hello world';
const result = parser.parse(input);
console.log(result);
// => { success: true, value: [ 'hello', ' ', 'world' ], index: 11 }
Examples
License
MIT License