develooper Front page | perl.perl6.language | Postings from April 2006

Re: [svn:perl6-synopsis] r8883 - doc/trunk/design/syn

Thread Previous | Thread Next
Damian Conway
April 20, 2006 13:33
Re: [svn:perl6-synopsis] r8883 - doc/trunk/design/syn
Message ID:
Larry wrote:

 > : I agree with Audrey that C<parse> is probably too useful in other
 > : contexts.  C<token:w> works fine for me.
 > Aesthetically, I hate :w, actually...and the whole point of naming "token"
 > is that it is *not* a normal parser rule, but a lexer rule.
 > But I agree that "parse" is probably the wrong word.  Earlier versions
 > had "prod" (short for "production")

Just to point out to those playing along at home that a "production" is one 
branch of an alternation, so it was right to reject that as the keyword.

 > or "words".

...which was not very informative. :-)

 > Even earlier versions made ordinary "rule" have these semantics, but
 > then it was too confusing to talk about rules in general. I was very
 > happy when I thought of splitting the concepts yesterday.
 > I will think about that some more today.  Consider "parse" a placeholder
 > for the concept of a plain old ordinary BNF rule.

I agree they should be split, but perhaps it's "rules in general" that
should be renamed, since plain old ordinary BNF has laid claim to "rule"
for several decades now? Perhaps we need to bow to historical (rather
than etymological) usage on "regex" too, yielding:

      Keyword    Implicit adverbs    Behaviour

       regex     (none)              Ignores whitespace, backtracks
       token     :ratchet            Ignores whitespace, no backtracking
       rule      :ratchet :words     Skips whitespace, no backtracking

Using C<rule> and C<token> as the typical grammar components would make
Perl 6 grammars *much* more accessible to those already familiar with
grammar-based parsing. And using C<regex> for "plain old backtracking regular 
expressions" would make them much more accessible to those already familiar 
with Perl 5 regexes.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About