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

Showing 1-5 of 5 messages
A Sixish question -- "::=" vs. regex lhs { rhs } Jeffrey Kegler 8/30/12 9:29 AM
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

Re: A Sixish question -- "::=" vs. regex lhs { rhs } Ron Savage 8/30/12 6:44 PM
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.
Re: A Sixish question -- "::=" vs. regex lhs { rhs } Peter Stuifzand 8/31/12 4:00 AM

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.


Re: A Sixish question -- "::=" vs. regex lhs { rhs } Ruslan Zakirov 8/31/12 1:50 PM
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.
Re: A Sixish question -- "::=" vs. regex lhs { rhs } Jeffrey Kegler 8/31/12 2:05 PM
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