tarsec
TypeScript icon, indicating that this package has built-in type declarations

0.0.14 • Public • Published
 __
/\ \__
\ \ ,_\    __     _ __   ____     __    ___
 \ \ \/  /'__`\  /\`'__\/',__\  /'__`\ /'___\
  \ \ \_/\ \L\.\_\ \ \//\__, `\/\  __//\ \__/
   \ \__\ \__/.\_\\ \_\\/\____/\ \____\ \____\
    \/__/\/__/\/_/ \/_/ \/___/  \/____/\/____/

A parser combinator library for TypeScript, inspired by Parsec.

Install

npm install tarsec

Hello world

import { getResults, str, seq, space } from "tarsec";

// define a parser
const parser = seq([
    str("hello"),
    space,
    str("world")
], getResults);

// then use it
parser("hello world"); // success
parser("hello there"); // failure

Learning tarsec

Features

  • tarsec is entirely TypeScript. There's nothing to compile.
  • Debug mode that prints what's happening step-by-step
  • Tools to debug your parser's performance
  • Derived types: tarsec will generate TypeScript types for your parser
  • Partial backtracking support

Read more about use cases for tarsec.

Contributing

PRs for documentation, tests, and bug fixes are welcome.

Package Sidebar

Install

npm i tarsec

Weekly Downloads

1

Version

0.0.14

License

ISC

Unpacked Size

78.1 kB

Total Files

18

Last publish

Collaborators

  • egonschiele