http://www.perlmonks.org?node_id=1053745


in reply to Simple Parser Combinator Implementation

I would love to see a dialog comparing withering's work with Perl 6's comparable features. If you know both, please summarize how they are similar and how they are different. If you know just parser combinators, or just Perl 6, please ask some questions to get things rolling. Here's hoping someone jumps in and we have an informative exchange. :)

  • Comment on Re: Simple Parser Combinator Implementation

Replies are listed 'Best First'.
Re^2: Simple Parser Combinator Implementation
by withering (Monk) on Sep 16, 2013 at 08:14 UTC

    That's a good point. I searched Perl 6 PEG and found it really powerful. Glad that PEG is now a core part of the language - it's rather exciting to write embedded DSLs with PEG, and if the implementation uses memoization, we could expect a better performance than native parser combinators ( and no worse than memoized combinators ) and a little more convenience than Frost's memoized combinators, which need some wrappers for handle real-world tokens.

    I'm not sure whether PEG in Perl 6 can handle ambiguous grammars or not. Parser combinators were designed to parse natural language sentences at first but were also found useful for parsing programming languages later. It seems not so necessary for PEG to choose the first match if the implementation can endure the memory cost when generating the intermediate representation.

      I suspect no one's going to bite here at PM. I encourage you to visit with Perl 6 folk on the #perl6 IRC channel and ask about Perl 6's PEG, its current and anticipated future performance, Graham Hutton's work, boost.spirit, your code, and development of related modules on CPAN for Perl 5. Larry Wall is often on the channel with the nick TimToady and I'm fairly confident he'll be delighted to discuss such matters. And you might bump into Patrick Michaud who has written numerous grammar engines over the years to match Perl 6's evolving design.

      (I read and summarize the daily logs so I'll see your discussion there.)