Skip to content

Muzietto/paco-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

paco-js

Parser combinators for the browser. Available at npm

File parsers.js contains an implementation of chainable parser combinators, featuring both applicative and monadic interfaces.

The complete parsers namespace is:

{
  parser,
  charParser,
  digitParser,
  predicateBasedParser,
  pchar,
  pdigit,
  andThen,
  andThenBind,
  orElse,
  fail,
  succeed,
  choice,
  anyOf,
  lowercaseP,
  uppercaseP,
  letterP,
  digitP,
  whiteP,
  fmap,
  returnP,
  applyPx,
  applyP,
  lift2,
  sequenceP,
  sequenceP2,
  pstring,
  stringP,
  zeroOrMore,
  many,
  manyChars,
  many1,
  manyChars1,
  opt,
  optBook,
  discardSecond,
  discardFirst,
  sepBy1,
  sepBy1Book,
  sepBy,
  between,
  betweenParens,
  bindP,
  tapP,
  logP,
  pword,
  trimP,
 }

how to use

  • import parsers from 'paco-js';

Test page for all the parsers (works also as progressive tutorial) is here.

Live examples page is here. Open devtools to see how the code works.

More examples are provided:

  • a complete converter from Markdown to HTML is here.
  • a complete parser for JSON strings is here, with a complete live test page here

NB - with a big credit due to Understanding Parser Combinators and to Paco.

This project is being maintained during Open Source Saturday

About

Parser combinators for the browser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published