Re: Compiling Perl6 code to bytecode

2010-01-30 Thread Moritz Lenz
Tadeusz Sośnierz wrote:
 On 29-01-2010 14:46:40, Moritz Lenz wrote:
 Hi,
 Hi, thanks for your response. 
 
 Tadeusz Sośnierz wrote:
  However, compiling the code for later use makes problems:
  
  $ perl6 --target=pir hello.pl  hello.pir
  $ parrot /usr/lib/parrot/2.0.0/languages/perl6/perl6.pbc hello.pir
 
 You should use parrot to turn the .pir file, not the Perl 6 compiler. So try
 
 parrot hello.pir
 
 instead.
 Well, when trying alone 'parrot hello.pir' I get the following:
 
 $ parrot hello.pir 
 load_bytecode couldn't find file 'perl6.pbc'

Did you run 'make install' in Rakudo? If you do, parrot should find
perl6.pbc.

Cheers,
Moritz


Compiling Perl6 code to bytecode

2010-01-29 Thread Tadeusz Sośnierz
Hello,
I recently got interested in Perl 6, installed Parrot 2.0.0 and Rakudo
2010-01. Running the code works fine:

$ cat hello.pl 
say Hello, world!
$ parrot /usr/lib/parrot/2.0.0/languages/perl6/perl6.pbc hello.pl
Hello, world!

However, compiling the code for later use makes problems:

$ perl6 --target=pir hello.pl  hello.pir
$ parrot /usr/lib/parrot/2.0.0/languages/perl6/perl6.pbc hello.pir
Confused at line 2, near \perl6\\n\n.
in Main (file unknown, line unknown)

I tried to ask for help on #perl6 on freenode, and the following seems
to work with rakudo compiled with --gen-parrot. Is this some known case
of separately used Parrot? Am I doing something wrong?

Kind regards,
Ted


Re: Compiling Perl6 code to bytecode

2010-01-29 Thread Moritz Lenz
Hi,

Tadeusz Sośnierz wrote:
 However, compiling the code for later use makes problems:
 
 $ perl6 --target=pir hello.pl  hello.pir
 $ parrot /usr/lib/parrot/2.0.0/languages/perl6/perl6.pbc hello.pir

You should use parrot to turn the .pir file, not the Perl 6 compiler. So try

parrot hello.pir

instead.

However it could be that the .pir is missing some loading directives
(known bug), it might be necessary to add

.loadlib 'perl6_group'
.loadlib 'perl6_ops'

at the beginning of the file (see perl6.pir for how it looks).

The good news is that if you compile a module to PIR, you don't need
such extra work.

 I tried to ask for help on #perl6 on freenode, and the following seems
 to work with rakudo compiled with --gen-parrot. Is this some known case
 of separately used Parrot? Am I doing something wrong?

I don't know of any such relation.

Cheers,
Moritz


Re: Compiling Perl6 code to bytecode

2010-01-29 Thread Richard Hainsworth
At present. But the development process has not reached a stage where 
compiling the main program produces any real benefit.


By the way, if you have used 'make install', then all you need is

/full/path/to/binary/perl6 scriptfile.p6 [args args args ...]

rather than
parrot /full/path/to/binary/perl6.pbc scriptfile.p6

I put a link to the perl6 binary in my path, so all I do is
perl6 scriptfile.p6

Also, you can then do a bare
perl6

... and you can enter one line programs from standard input. This is a 
quick way to test whether bits of code work.


Richard

Tadeusz Sośnierz wrote:

On 29-01-2010 17:03:14, Richard Hainsworth wrote:
  

Unless things have changed recently, it is possible to compile a
module to pir, and 'use' the module in the main program. Rakudo
correctly links in the code.

It was not possible to compile the main program to pir, which should
in any case be called with parrot.

Note that in your example perl6.pbc is expecting a perl script, not pir.

But it is possible to compile the main program to pir, then have a
short perl6 script to 'use' the module.

Richard



Well, so the only way is to compile everything as modules, and short
main script which will use the module and be compiled every time? Do I
understand it right?

Regards,
Ted