"Top-down parsing is guessing": new blog post.

45 views
Skip to first unread message

Jeffrey Kegler

unread,
Dec 20, 2015, 10:19:10 PM12/20/15
to Marpa Parser Mailing LIst
My newest post is second in a series about top-down parsing, and Perl 6 grammars.

This first post in the series was "Grammar reuse".   I forgot to announce the first one to this group when it came out.  Sorry!


davidnm...@gmail.com

unread,
Dec 31, 2015, 7:14:51 PM12/31/15
to marpa parser
Hi Jeffrey,

I was intrigued by these two posts, but left wondering if Marpa does support grammar reuse / extension?

I'd love to be able to declare a grammar as a class containing a series of tokens and be able to inherit and override individual tokens ala Perl 6.

If it doesn't support it now, could Marpa support it? I've been working on a Perl 6 Grammar for Pod (https://github.com/dnmfarrell/Pod-Perl5), and would love to try parsing Pod with Marpa. But I want to be able to extend the base Pod grammar with new syntax without having to copy and paste the original grammar into a new class.

Many thanks

David

Jeffrey Kegler

unread,
Dec 31, 2015, 7:20:49 PM12/31/15
to Marpa Parser Mailing LIst
"Support" is being used in two different senses here.
1.) "have the horsepower in the grammar engine to allow grammar reuse".
2.) "have a syntax that makes it convenient to specify, without respect to whether it works".

I will plead guilty to having given 2.) the lower priority.  And, yes, Marpa would support 2.) better than any alternative out there.

--
You received this message because you are subscribed to the Google Groups "marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email to marpa-parser...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ron Savage

unread,
Dec 31, 2015, 8:39:35 PM12/31/15
to marpa parser, davidnm...@gmail.com
There are various modules which patch the BNF on the fly, as a way of combining parts of a grammar. See:


https://metacpan.org/pod/Text::Delimited::Marpa

Also, in this list, http://savage.net.au/Marpa.html#Perl_Packages, J Durand has a number of modules, some of which likewise patch the BNF.

Jeffrey Kegler

unread,
Dec 31, 2015, 8:44:41 PM12/31/15
to Marpa Parser Mailing LIst
Re your specific problem -- POD for Perl 6.

POD is a hackish grammar, designed to be parsed by RE's and/or top-down methods.  It's something Perl 6 grammars should be able to do reasonably well.

There is an effort to port Marpa to Perl 6 underway, but it has only ported the lower layers, and what you want requires the upper ones.  I hear hints the Perl 6 team may look harder at Marpa once the current release stabilizes.  Previously I think they may have expected top-down methods could support things like language-oriented programming and nothave seen the need for something like Marpa.

So, in your place, if your intent is creating a Perl 6-based POD parser, you might as well take a first crack at it using Perl 6 grammars.  They should get the basic job done, and a Marpa infrastructure inside Perl 6 is just not ready.

David Farrell

unread,
Jan 2, 2016, 11:34:41 PM1/2/16
to marpa-...@googlegroups.com
Thanks Jeffrey and Ron for the replies, very informative.

--
You received this message because you are subscribed to a topic in the Google Groups "marpa parser" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/marpa-parser/DSW4cZaAsXc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to marpa-parser...@googlegroups.com.

Durand Jean-Damien

unread,
Jan 3, 2016, 6:45:35 AM1/3/16
to marpa parser, davidnm...@gmail.com
Also, in this list, http://savage.net.au/Marpa.html#Perl_Packages, J Durand has a number of modules, some of which likewise patch the BNF.


All are "hacks" in the sense that there is no meta-package describing the BNF itself. Once I had a look to Grammar::Formal though, that looked promising in such direction 

Ron Savage

unread,
Jan 3, 2016, 4:37:55 PM1/3/16
to marpa parser, davidnm...@gmail.com
Well, yes. All treat the BNF as a string, not as an object with attributes and methods.

I had never heard of Grammar::Formal before you mentioned it. The MetaCPAN reverse dependencies list is empty, meaning - apparently - there are no modules using it.

Reply all
Reply to author
Forward
0 new messages