Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to compile to PIR or byte codes

0 views
Skip to first unread message

Colin Paul Adams

unread,
May 20, 2005, 10:13:52 AM5/20/05
to perl6-c...@perl.org
I am trying to work out how to compile a perl script using pugs.
(Am I on the right mailing list?)

If I do pugs -h, then it suggests to me the -C option will do the
trick, but does not say what value the backend might be.

But I'm also having trouble running the script. It runs OK with perl
5, but pugs complains:

*** Error:
unexpected "f"
expecting ";" or "}" at string_value.p6 line 5, column 5

The script is:

#!/usr/bin/perl
sub test {
return unless defined wantarray; # void context, do nothing
my @parms = @_;
for (@parms) { tr/a-z/A-Z/ }
return wantarray ? @parms : $parms[0];
}

print test ("ok")


so it seems to dislike the for, but I guess it's something that comes
before that. Is there a list of incompatibilites with perl 5 anywhere?
(I might add that I know very little at all about perl).
--
Colin Adams
Preston Lancashire

Autrijus Tang

unread,
May 20, 2005, 12:04:31 PM5/20/05
to Colin Paul Adams, perl6-c...@perl.org
On Fri, May 20, 2005 at 03:13:52PM +0100, Colin Paul Adams wrote:
> I am trying to work out how to compile a perl script using pugs.
> (Am I on the right mailing list?)

Well, yes and no. To run Perl 5 in Parrot, you want the ponie-dev
mailing list -- this is perl6-compiler after all. :-)

> If I do pugs -h, then it suggests to me the -C option will do the
> trick, but does not say what value the backend might be.

Thanks, the latest trunk now suggests ays:

-Cbackend compile using the compiler backend
(valid backends are: Pugs, Parrot, Haskell

> so it seems to dislike the for, but I guess it's something that comes
> before that. Is there a list of incompatibilites with perl 5 anywhere?
> (I might add that I know very little at all about perl).

The short answer is that Perl6->Parrot codegen is currently very
primitive in Pugs; I expect to improve it next month with Leo and Chip,
but currently it's not robust at all.

However, for some (minimal) success in embedding Perl 6 via Parrot, see
mod_parrot, which has a mod_pugs layer:

http://www.smashing.org/mod_parrot/

The long answer is that, in general, Perl 5 script will not run as Perl 6
without some conversion. The definitive documents about Perl 6 is the
Synopses:

http://dev.perl.org/perl6/

There are various quick-references in the Pugs tree, assuming you know
some Perl 5:

http://svn.openfoundry.org/pugs/docs/quickref/

There is also a Perl 5 to Perl 6 "porting guide":

http://perlmonks.org/index.pl?node_id=442402

Larry is working on a translator that can compile Perl 5 program into
Perl 6, known as PPD, but it's not released yet. Nicholas Clark is heading
an effort to run Perl 5 on top of Parrot VM, known as Ponie:

http://poniecode.org/

Thanks,
/Autrijus/

0 new messages