On Fri, Jul 04, 2008 at 12:15:24AM +0200, Moritz Lenz wrote:
> Hi,
> 
> Gerd Pokorra wrote:
> > I suggest the little attached patch (diff -u) for the file
> > "languages/perl6/src/parser/grammar.pg", so that the following code
> > 
> > my $a = .2;
> > 
> > will also be accepted from Rakudo.
> 
> But does the language specification allow it? I don't think so, and
> STD.pm (after which rakudo's parser is modeled) doesn't allow it.

According to S02:420, a leading dot is allowed to introduce a Num:

    ... (The C<.123> form with a leading dot is still allowed 
    however when a term is expected, and is equivalent
    to C<0.123> rather than C<$_.123>.)

Moritz is correct, however, that STD.pm doesn't seem to allow this
yet, and since Rakudo is trying to follow STD.pm as closely as
we can, we may just wait to see what STD.pm does.  Also, the 
patch seems to have a bug in it, as it replaces C< \d+[_\d+]* >
with C< \d*d[_\d+]* >.  I'm not sure what the extra 'd' in '\d*d' 
is supposed to represent, but I'm pretty sure it's wrong.  And 
if we just use

    \d*[_\d+]*

then we end up with the case that 'E+3' can be parsed as a
valid <dec_number>.

Thanks for the patch, though -- perhaps if we tweak it enough it'll
get adopted into STD.pm (and then we can more comfortably add it
to rakudo).

Pm

Reply via email to