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

The "parse" composer

Thread Previous | Thread Next
Audrey Tang
April 20, 2006 07:09
The "parse" composer
Message ID: wrote:
> +=item *
> +
> +Just as C<rx> has variants, so does the C<rule> declarator.
> +In particular, there are two special variants for use in grammars:
> +C<token> and C<parse>.

After a brief discussion on #perl6 with pmichaud and Juerd, it seems
that a verb "parse" at the same space as "sub"/"method"/"rule" feels
quite confusing:

    grammar Foo {
        parse moose {...}; # calling &parse?
    my $elk = parse {...}; # calling &parse?

We feel that the token:w form is short enough and better reflect the

    grammar Foo {
        token moose :w {...}
    my $elk = token:w {...};

If further huffmanization is highly desired, how about allowing adverbs
at the beginning of token/rule forms?

    grammar Foo {
        token:w moose {...};
        rule:P5 foo {...};

That would make it stand out, without further consuming the reserved
word space.


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