Parsec (parser)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Parsec is a library for writing parsers in Haskell.[1] It is based on higher-order parser combinators, so a complicated parser can be made out of many smaller ones.[2] It has been reimplemented in many other languages, including Erlang,[3] OCaml,[4] and F#,[5][6] as well as imperative languages such as C#,[7] and Java.[8]

Because a parser combinator-based program is generally slower than a parser generator-based program, Parsec is normally used for small domain-specific languages, while Happy is used for compilers such as GHC.[9]


  1. ^ "Parsec on Haskell wiki". Retrieved 29 May 2017. 
  2. ^ "Parsec: Direct Style Monadic Parser Combinators For The Real World" (PDF). Retrieved 22 November 2014. 
  3. ^ "Parsec Erlang". Retrieved 23 November 2014. 
  4. ^ "Parsec OCaml" (PDF). Retrieved 23 November 2014. 
  5. ^ "XParsec by corsis". Retrieved 29 May 2017. 
  6. ^ "FParsec". Retrieved 29 May 2017. 
  7. ^ "CSharp monad". Retrieved 10 December 2014. 
  8. ^ "JParsec". Retrieved 14 October 2016. 
  9. ^ "The Glasgow Haskell Compiler (AOSA Vol. 2)". Retrieved 23 November 2014. 

External links[edit]