Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6153547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:06:44+00:00 2026-05-23T20:06:44+00:00

Are there any parser combinators library that gives performance comparable to Happy/Alex ? I

  • 0

Are there any parser combinators library that gives performance comparable to Happy/Alex ?

I know about Attoparsec, but sometimes it operates not well, like in an example below:

isToken c = isLetter c || isDigit c

symbol :: Parser Expr
symbol = do 
    c    <- skipSpace >> satisfy isLetter 
    rest <- takeWhile isToken
    let token = C.cons c rest  -- oops... O(N)
    error $ show token

The workaround is quite ugly:

do { skipSpace; bs <- scan go True; when (null bs) (fail "Not a symbol"); return bs}
    where go True  c = if isLetter c then Just  False else Nothing
          go False c = if isToken c then Just Fasle else Nothing

Also, Attoparsec lacks of error handling.

Happy/Alex are quite unfriendly (for me) comparing to ocamlyacc/ocamllex, BNFC is inflexible
and in my case requires an additional AST traversing after parsing. Also, error handling is not very good.

There are three of rest options: Parsec2, Parsec3 and uu-parselib. I’ve found a number of controversial benchmarks assuming that Parsec2 is faster than Parsec3, or UU is faster, or it’s slower.

But what to choose? Does anyone have an experience using uu-parselib? I need the parser for some kind of DSL, need the parses fast enough to not to change it in future.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:06:45+00:00Added an answer on May 23, 2026 at 8:06 pm
    1. There is another alternative: polyparse.

    2. After last year’s GSoC, parsec3 was optimized and no longer noticeably slower than parsec2

    3. Couple of years ago I’ve done tests on several grammars (mid-size) and found that performance of happy/alex, parsec2/alex, parsec2 and polyparse is very close. Attoparsec was faster on byte streams, but I needed multi-byte.

    My advise: take a look at the way alternatives handle internal and user-defined state and report errors and choose by these criteria.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any tool that can parse a valid C program and generate a
Are there any existing libraries in existence that will parse a datetime from a
Are there any automated tools that will parse through XAML code and clean out
Are there any .NET-specific tools out there that can parse / access the elementary
Are there any open source libraries (any language, python/PHP preferred) that will tokenize/parse an
Hi is there any tool available in Java world that will parse/read a source
Just as the title asks: are there any XML pull parser implementations in a
Is there any Python library or some sample code which demonstrates how to convert
Is there any existing JSON parser which can be used from VB6? I could
Is there any (E)BNF parser out there which is able to generate XML trees

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.