A Sixish question -- "::=" vs. regex lhs { rhs }

21 views
Skip to first unread message

Jeffrey Kegler

unread,
Aug 30, 2012, 12:29:18 PM8/30/12
to Marpa Parser Mailing LIst
As mentioned, I am considering an interface to Marpa modeled after Perl
6. I call this my "Sixish" project.

I'd appreciate feedback from the group on one point. Marpa users seem
to regard the EBNF notation of rules as natural. That is, left to
themselves they write rules like this:

<X> ::= <A> <B> <C>

On the other hand, Perl 6 does its equivalent of BNF rules this way:

regex X { <A> <B> <C> }

Should I allow the EBNF style, despite it's not being strict Perl 6?
Would that make Sixish more user-friendly in your eyes?

Thanks, jeffrey kegler


Ron Savage

unread,
Aug 30, 2012, 9:44:32 PM8/30/12
to marpa-...@googlegroups.com
Hi Jeffrey

I'd be tempted to allow it, because doing so lowers the entry/adoption barrier for people used to BNF but not used to Perl6. And that's a lot of people.

It also makes it simpler for everyone, even Perl6 programmers, to transfer a BNF they've encountered elsewhere into Marpa.

I'd stop at 2 alternatives though, since Perl's famous TMTOWTDI sometimes makes it very hard for beginners to choose a solution or implementation to a problem.

Peter Stuifzand

unread,
Aug 31, 2012, 7:00:00 AM8/31/12
to marpa-...@googlegroups.com

I think both input formats should exist, but you should probably only use the Perl6 style syntax for this project.

Maybe it's possible to create a way to switch (parse and generate) between the two formats by using the same representation underneath? This would allow for many tools around both formats.

Peter

Ruslan Zakirov

unread,
Aug 31, 2012, 4:50:05 PM8/31/12
to marpa-...@googlegroups.com
How hard would it be to subclass grammar/parser to change syntax from
EBNF style to perl 6 style?

> Thanks, jeffrey kegler

--
Best regards, Ruslan.

Jeffrey Kegler

unread,
Aug 31, 2012, 5:05:40 PM8/31/12
to marpa-...@googlegroups.com
Actually, I think I can just allow the two styles to be intermixed.  Not to say that it's a good idea to write a grammar that way, but the UNIX/Perl/C tradition is to let the user decide those things, when possible.

-- jeffrey
Reply all
Reply to author
Forward
0 new messages