Hello,

here same output:


First a test with pugs Version: 6.2.13 (r17105) which use STD.pm

[EMAIL PROTECTED] ~]$ pugs -e 'my $a=.2; say $a' 
0.2
[EMAIL PROTECTED] ~]$ pugs -e 'my $a=E+3'
*** No such subroutine: "&E"
    at -e line 1, column 3 - line 2, column 1
[EMAIL PROTECTED] ~]$ 


The second with Rakudo
 as it replaces C< \d+[_\d+]* > with C< \d*[_\d+]* >

[EMAIL PROTECTED] parrot]$ ./perl6 -e 'my $a=.2; say $a'
0.2
[EMAIL PROTECTED] parrot]$ ./perl6 -e 'my $a = E+3'
undefined identifier 'E'
current ....


The third with Perl 5

[EMAIL PROTECTED] parrot]$ perl -e 'my $a = E+3; print "$a\n"'
3
[EMAIL PROTECTED] parrot]$ 


I think E+3 = 3 make no sense.

Gerd Pokorra


Am Donnerstag, den 03.07.2008, 23:09 -0500 schrieb Patrick R. Michaud:
> 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