terrario
A Parsimmon-like, stateful parser-combinator library with TypeScript. Try it out!
The terrario is a parser-combinator library inspired by PEG.js, Parsimmon, etc.
Installation
npm i terrario
Documenation
Basic Example
import * as P from 'terrario';
// build a parser
const parser = P.str('hello world');
// parse the input string
const input = 'hello world';
const result = parser.parse(input);
// check errors
if (!result.success) {
throw new Error('parsing failed.');
}
console.log(result);
// => { success: true, value: 'hello world', index: 11 }
Examples
License
MIT License