A Parsimmon-like, stateful parser-combinator library with TypeScript.

Overview

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.

NPM

Installation

npm i terrario

Documenation

Docs

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

You might also like...

A simple inefficient and buggy JSON parser written in JavaScript. Just a fun project

A simple inefficient and buggy JSON parser written in JavaScript. Just a fun project

A simple inefficient and buggy JSON parser written in JavaScript This JSON parser isn't guaranteed to work properly. Its recommended to use builtin JS

Feb 20, 2022

💬 A Twitch (BTTV and FFZ) emotes and badges parser - built with tmi.js in mind

💬 A Twitch (BTTV and FFZ) emotes and badges parser - built with tmi.js in mind

Sep 2, 2022

Request-Header-Parser-Microservice App for FreeCodeCamp Backend Challenge

API Project: Request Header Parser Microservice for freeCodeCamp User stories: I can get the IP address, preferred languages (from header Accept-Langu

Mar 20, 2022

Binary-encoded serialization of JavaScript objects with generator-based parser and serializer

YaBSON Schemaless binary-encoded serialization of JavaScript objects with generator-based parser and serializer This library is designed to transfer l

Aug 9, 2022

Color palette text parser to a function, compatible with GMT, GDAL, GRASS, PostGIS, ArcGIS

cpt2js Color palette text parser to a function, input compatible with GMT, GDAL, GRASS, PostGIS, ArcGIS Demo From GDAL docs: The text-based color conf

Dec 4, 2022

A WASM shell parser and formatter with bash support, based on mvdan/sh

sh-syntax A WASM shell parser and formatter with bash support, based on mvdan/sh TOC Usage Install API Changelog License Usage Install # yarn yarn add

Jan 1, 2023

A simple C++ function parser/tagger based on tree-sitter

What the func?! - A simple C++ function parser/tagger This project implements a simple C++ function parser, what-the-func, based on the tree-sitter C+

May 21, 2022

Simple and Extensible Markdown Parser for Svelte, however its simplicity can be extended to any framework.

svelte-simple-markdown This is a fork of Simple-Markdown, modified to target Svelte, however due to separating the parsing and outputting steps, it ca

May 22, 2022

A querystring parser with nesting support

A querystring parser with nesting support

qs A querystring parsing and stringifying library with some added security. Lead Maintainer: Jordan Harband The qs module was originally created and m

Jan 4, 2023
Comments
  • seq()の型定義

    seq()の型定義

    Description

    #7 の実装

    TODO

    • 型定義
      • [x] selectorなしのときの返り値
        ユニオンの型変数として受け取りたい~~がなんもわからん~~のです! -> https://misskey.io/notes/93kppsqs6d
      • [x] selectorありのときの返り値
        引数の型宣言を[...T]みたいに書くとタプル型をいい感じに受け取れるっぽく、できた
      • [x] 3つ目のやつの返り値
        1つ目のやつができればいけそう

    Issue ID

    #7

    opened by ThinaticSystem 8
Releases(v0.7.1)
Owner
marihachi
{ lang: [ TypeScript, C#, C ], interest: [ Parsing, Semantic analysis, Embedded firmwares, Desktop apps ] }
marihachi
A simple library for Node and the browser that allows you to rapidly develop stateful, socketed multiplayer games and web applications.

gameroom.js Overview gameroom.js is a simple library for Node and the browser that allows you to rapidly develop stateful, socketed multiplayer games

Jackson Bierfeldt 3 Nov 3, 2022
Json-parser - A parser for json-objects without dependencies

Json Parser This is a experimental tool that I create for educational purposes, it's based in the jq works With this tool you can parse json-like stri

Gabriel Guerra 1 Jan 3, 2022
This is a test parser which can automatically parse the tests in from websites like codeforces, codechef, atcoder etc.

✔ Sublime test parser This is a test parser which can automatically parse the tests in from websites like codeforces, codechef, atcoder etc. See how i

Prakhar Rai 15 Aug 6, 2022
A work-in-progress HTML sanitizer that strives for: performance like window.Sanitizer, readiness like DOMPurify, and ability to run in a WebWorker like neither of those.

Amuchina A work-in-progress HTML sanitizer that strives for: performance like window.Sanitizer, readiness like DOMPurify, and ability to run in a WebW

Fabio Spampinato 9 Sep 17, 2022
A lightweight Adobe Photoshop .psd/.psb file parser in typescript with zero-dependency for WebBrowser and NodeJS

@webtoon/psd A lightweight Adobe Photoshop .psd/.psb file parser in typescript with zero-dependency for WebBrowser and NodeJS Browser Support Chrome F

null 830 Jan 1, 2023
TypeScript dotbim parser and encoder.

dotbim-ts Open-source TypeScript parser and encoder for dotbim file format. dotbim's website: https://dotbim.net/ Here you can find small manual for d

Baid 5 Aug 2, 2022
Jsonup - This is a zero dependency compile-time JSON parser written in TypeScript

jsonup This is a zero dependency compile-time JSON parser written in TypeScript.

TANIGUCHI Masaya 39 Dec 8, 2022
A Laravel Blade parser, compiler, and static analyzer written in TypeScript.

Blade Parser This library provides a Laravel Blade parser written in TypeScript. In addition to being able to parse Blade template files, this library

Stillat 7 Jan 4, 2023
Live port of Lark's standalone parser to Javascript

Lark.js Generate LALR(1) parsers in Javascript Lark is a popular parsing toolkit for Python. This project is a live port of the Lark standalone parser

Lark - Parsing Library & Toolkit 51 Nov 19, 2022
A markdown parser and compiler. Built for speed.

Marked ⚡ built for speed ⬇️ low-level compiler for parsing markdown without caching or blocking for long periods of time ⚖️ light-weight while impleme

Marked 28.9k Jan 7, 2023