Terrario
A refined, expressive parser combinator library.
Install / Use
/learn @terrario-js/TerrarioREADME
A refined, expressive parser combinator library. Try it out!
- 📍 Minimal yet powerful APIs
- 🖨 Supports scannerless parsing and tokens 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.token('hello'),
T.token('world'),
T.token(' '),
]).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
Related Skills
node-connect
341.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Writing Hookify Rules
84.6kThis skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
review-duplication
99.6kUse this skill during code reviews to proactively investigate the codebase for duplicated functionality, reinvented wheels, or failure to reuse existing project best practices and shared utilities.
