All Projects → disnet → parser-lang

disnet / parser-lang

Licence: other
A parser combinator library with declarative superpowers

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to parser-lang

autumn
A Java parser combinator library written with an unmatched feature set.
Stars: ✭ 112 (+348%)
Mutual labels:  parsing, parser-combinators, parser-combinator
Lug
Parsing expression grammar (PEG) embedded domain specific language and parsing machine for C++17
Stars: ✭ 44 (+76%)
Mutual labels:  parsing, parser-combinators
metal
A Java library for parsing binary data formats, using declarative descriptions.
Stars: ✭ 13 (-48%)
Mutual labels:  parsing, parser-combinators
Parsing With Haskell Parser Combinators
🔍 A step-by-step guide to parsing using Haskell parser combinators.
Stars: ✭ 72 (+188%)
Mutual labels:  parsing, parser-combinators
Scala Parser Combinators
simple combinator-based parsing for Scala. formerly part of the Scala standard library, now a separate community-maintained module
Stars: ✭ 523 (+1992%)
Mutual labels:  parsing, parser-combinators
Comby
A tool for structural code search and replace that supports ~every language.
Stars: ✭ 912 (+3548%)
Mutual labels:  parsing, parser-combinators
Parser Combinators From Scratch
Code that accompanies the series
Stars: ✭ 56 (+124%)
Mutual labels:  parsing, parser-combinators
parser-combinators
Lightweight package providing commonly useful parser combinators
Stars: ✭ 41 (+64%)
Mutual labels:  parsing, parser-combinators
Parjs
JavaScript parser-combinator library
Stars: ✭ 145 (+480%)
Mutual labels:  parsing, parser-combinators
Combine
A parser combinator library for Elixir projects
Stars: ✭ 174 (+596%)
Mutual labels:  parsing, parser-combinators
Funcparserlib
Recursive descent parsing library for Python based on functional combinators
Stars: ✭ 250 (+900%)
Mutual labels:  parsing, parser-combinators
Pidgin
C#'s fastest parser combinator library
Stars: ✭ 469 (+1776%)
Mutual labels:  parsing, parser-combinators
Angstrom
Parser combinators built for speed and memory efficiency
Stars: ✭ 434 (+1636%)
Mutual labels:  parsing, parser-combinators
Ramble
A R parser based on combinatory parsers.
Stars: ✭ 19 (-24%)
Mutual labels:  parsing, parser-combinators
Pom
PEG parser combinators using operator overloading without macros.
Stars: ✭ 310 (+1140%)
Mutual labels:  parsing, parser-combinators
Pyparsing
Python library for creating PEG parsers
Stars: ✭ 1,052 (+4108%)
Mutual labels:  parsing, parser-combinators
arborist
Arborist is a PEG parser that supports left-associative left recursion
Stars: ✭ 17 (-32%)
Mutual labels:  parsing, parser-combinator
loquat
Monadic parser combinators for JavaScript / TypeScript
Stars: ✭ 47 (+88%)
Mutual labels:  parsing, parser-combinators
Pegtl
Parsing Expression Grammar Template Library
Stars: ✭ 1,295 (+5080%)
Mutual labels:  parsing, parser-combinators
Syntax
Write value-driven parsers quickly in Swift with an intuitive SwiftUI-like DSL
Stars: ✭ 134 (+436%)
Mutual labels:  parsing, parser-combinators

npm version Build Status Contributor Covenant

ParserLang

ParserLang is parser combinator library. It lets you make parsers by combining other parsers.

Its primary superpower is the ability to define parsers declaratively with template literals:

import { lang } from 'parser-lang';

let { calc } = lang`
  num = /[0-9]+/ > ${ch => parseInt(ch, 10)};

  addExpr = num '+' multExpr > ${([left, op, right]) => left + right}
          | num ;

  multExpr = addExpr '*' multExpr > ${([left, op, right]) => left * right}
           | addExpr ;
  
  calc = multExpr ;
`;

calc.tryParse('1+1*2');
// 3

It's monadic and stuff but don't get too hung up on that. It tries to be very friendly.

Installing

npm install parser-lang

Documentation

Related Projects/Papers

  • Parsimmon - a JavaScript parser combinator library. ParserLang is heavily inspired by Parsimmon. Parsimmon is more coupled to parsing strings (ParserLang uses the Context protocol to support a variety of input types) but also supports a wider variety of JavaScript runtimes.
  • Parsec - a Haskell parser combinator library
  • Monadic Parser Combinators - one of the seminal papers describing parser combinators
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].