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

The "parse" composer

Thread Previous | Thread Next
From:
Audrey Tang
Date:
April 20, 2006 07:09
Subject:
The "parse" composer
Message ID:
444795F6.7080901@audreyt.org
larry@cvs.perl.org 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
similarity:

    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.

Thanks,
Audrey


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About