Parsing domain names, and cookies

30 views
Skip to first unread message

Ron Savage

unread,
Oct 3, 2014, 5:30:15 PM10/3/14
to marpa-...@googlegroups.com
Here's a potential project:


Christopher Layne

unread,
Oct 3, 2014, 5:35:17 PM10/3/14
to marpa-...@googlegroups.com
I probably wouldn't use a grammar/parser for something that is literally just dot-separated atoms.

-cl

On Oct 3, 2014, at 1430 PT, Ron Savage <r...@savage.net.au> wrote:

> Here's a potential project:
>
> https://publicsuffix.org/
>
>
> --
> 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.

Jeffrey Kegler

unread,
Oct 3, 2014, 5:43:55 PM10/3/14
to Marpa Parser Mailing LIst
I'm happy to see people becoming very aggressive about using Marpa, but a good rule of thumb is that if something is a regular expression in the narrowest sense, and is not super-large, you should use a regex engine.

"Regular expression in the narrowest sense" means something built up entirely from concatenations, '*', '+', '|'.  For these, even a mediorce regex engine just murders Marpa.

-- jeffrey

Ron Savage

unread,
Oct 3, 2014, 5:44:35 PM10/3/14
to marpa-...@googlegroups.com
Yes, Marpa seems like overkill. But it'd be slightly interesting to handle the between-lines linkages.

Ron Savage

unread,
Oct 3, 2014, 6:45:02 PM10/3/14
to marpa-...@googlegroups.com
Ok, ok! Case closed :-).

Ed Avis

unread,
Oct 9, 2014, 6:24:20 AM10/9/14
to marpa-...@googlegroups.com
If the grammar is regular, could Marpa spit out a regular expression that
generates the same strings?

--
Ed Avis <e...@waniasset.com>

Jeffrey Kegler

unread,
Oct 9, 2014, 8:26:37 AM10/9/14
to marpa-...@googlegroups.com
Marpa as a front end to [the regular expression engine of your choice]?
Yes, It's quite doable and something I'd like to see written.

Whether or not a BNF grammar describes a regular expression is
decidable, and not terribly hard to determine in fact. Ironically, a
Marpa grammar might be a way of making parsing with big regular
expressions more feasible, by making them more readable and maintainable.

Marpa parsing as itself would still have the advantage in error
reporting, however. But some apps would lend themselves to a dual approach.

1.) Have Marpa write a regex, which will run faster than the Marpa
Earley engine on success.
2.) But on failure, reparse with Marpa's own engine to pinpoint the
exact problem.

-- jeffrey

Durand Jean-Damien

unread,
Oct 9, 2014, 3:44:44 PM10/9/14
to marpa-...@googlegroups.com
It is overkill, but the proof of concept is more than that, since this was writen for ECMAScript, c.f. this post on blogs.perl.org (which have semantics 99% like perl, with a big vicous exception for what is the "last match").

Ron Savage

unread,
Oct 9, 2014, 5:34:26 PM10/9/14
to marpa-...@googlegroups.com
Thanx Jean-Damien. I've added that article to Marpa's homepage.

Michael Roberts

unread,
Oct 10, 2014, 5:18:22 AM10/10/14
to marpa-...@googlegroups.com


On Thursday, October 9, 2014 2:26:37 PM UTC+2, Jeffrey Kegler wrote:
Marpa as a front end to [the regular expression engine of your choice]?  
Yes, It's quite doable and something I'd like to see written.


Correct me if I'm wrong, but this is a matter of writing a different semantics for BNF, right? (One that would only accept a restricted set of BNF, I suppose?) So that you'd have a given grammar, and either interpret it to create a Marpa parser or a regexp output for use in a regexp engine? 

Jeffrey Kegler

unread,
Oct 10, 2014, 5:25:05 AM10/10/14
to marpa-...@googlegroups.com
Yes, exactly. -- jeffrey

Michael Roberts

unread,
Oct 10, 2014, 5:50:29 AM10/10/14
to marpa-...@googlegroups.com, Jeffrey Kegler

Michael Roberts

unread,
Oct 10, 2014, 5:51:38 AM10/10/14
to marpa-...@googlegroups.com, Jeffrey Kegler
Also, dude. You're in North America. Why are you even awake?

On Fri, 10 Oct 2014 11:25:04 +0200, Jeffrey Kegler <jeffre...@jeffreykegler.com> wrote:

Ron Savage

unread,
Oct 10, 2014, 6:02:02 PM10/10/14
to marpa-...@googlegroups.com, jeffre...@jeffreykegler.com
That's Marpa's own grammar, so libmarpa reads that and uses it (that file) to validate it (that file), which is indeed self-referential.

Then Marpa uses that grammar to validate your grammar.

Reply all
Reply to author
Forward
0 new messages