Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 575 Bytes

README.md

File metadata and controls

28 lines (22 loc) · 575 Bytes

Parser Combinators library in TypeScript

:) coded live at cdecompilador twitch

Examples

Simple usage example

new Pair(new Match("Hello"), new Item()).map((_) => ":)").parse("Hello World");
/*
  This generates:
  {
    state: Result.Ok,
    remainder: "World",
    value: ":)"
  }
*/

Contains simple Json parser implemented with the library as proof of concept

new JsonObject().parse("{'hello': 'world'}");
/*
  This parses JSON and returns a JavaScript object, equivalent to `JSON.parse` :D
*/