Lexy: A parser combinator library for C++17

(github.com)

43 points | by klaussilveira 3 days ago

3 comments

  • fooker 1 hour ago
    Neat. If you add some automatic memoization, I'll use it for my next project!

    Here's the use case:

    expr := ...

    rule1 := expr foo expr

    rule2 := expr bar

    When trying to match rule1 and failing, it is great to have the expr part of it already parsed and ready for trying out rule2.

    This doesn't have to be done extremely well (see PEG/Packrat parsing for that) but even a little bit, maybe one term or something like that helps a lot.

  • jokoon 1 hour ago
    I parsed my language with it, it's fast and works well.

    Pressing rules are written in c++ directly, with templates.

    Although if you have no experience in parsing, the learning curve could be a bit steep.

  • o11c 3 hours ago
    This appears to avoid one of the classic bugs with parser combinators (expensive backtracking and/or memory-use), but appears not to fix one of the other catastrophes.

    To be explicit: one of the "features" this advertises is equivalent to saying "if you stop compiling your code with `-Wall`, you don't have to deal with all those pesky warnings!"

    • jibal 1 hour ago
      You have an odd notion of "explicit". There's no need to be coy ... spell it out.
    • tempodox 1 hour ago
      What “other catastrophes”? Are you being deliberately mysterious?