The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

v6 - An experimental Perl 6 implementation

SYNOPSIS

    # file: hello_world.pl
    use v6-alpha;
    "hello, world".say;

    $ perl hello_world.pl

v6-alpha can be used in one-liners:

    $ perl -e 'use v6-alpha' ' 42.say '
    $ perl -e 'use v6-alpha' - ' 42.say '
    $ perl -e 'use v6-alpha' - --compile-only ' 42.say '
    $ perl -e 'use v6-alpha' - -Ilib6 ' 42.say '
    $ echo 42.say | perl -e 'use v6-alpha' 

v6.pm can also be used as a plain program. This examples assume that v6.pm is in the ./lib directory:

    $ perl lib/v6.pm -e 'for 1,2,3 -> $x { say $x }'
    $ perl lib/v6.pm --compile-only -e '<hello>.say;'

Print the version banner:

    $ perl -e 'use v6-alpha' - -v
    $ perl lib/v6.pm -v

DESCRIPTION

The v6 module is a front-end to the experimental Perl6-to-Perl5 compiler.

The current state of this compiler implementation only provides a small sample of Perl 6 syntax and semantics.

Other Perl 6 implementations

Pugs Perl 6 is currently the most complete implementation. Pugs is written on top of Haskell.

Perl 6 on Parrot aims to become the best performing implementation. Parrot is a virtual machine designed to efficiently compile and execute bytecode for interpreted languages.

v6.pm is completely independent of Pugs or Parrot.

Compile-time system

Pugs::Compiler::Rule provides an implementation for Perl 6 Rules, which are used to define the Perl 6 grammar.

Parse::Yapp is used for implementing the operator precedence parser.

Module::Compile and Cache::Cache provide the precompilation cache infrastructure.

Runtime system

The object system is provided by Moose. Moose is an extension of the Perl 5 object system. Moose is built on top of Class::MOP, which is a metaclass system for Perl 5.

Data::Bind and Sub::Multi implement the semantics for perl6-style variable binding, as well as subroutine call argument passing and binding, in Perl 5.

REQUIREMENTS

- The source file header must be valid perl5 and perl6 code.

This is a valid header:

    #!/usr/bin/perl
    use v6-alpha;

* it executes perl5

* perl5 will call the v6.pm module.

This is an invalid header:

    #!/usr/bin/pugs
    use v6;

* it tells perl5 to execute /usr/bin/pugs.

* it tells perl5 that Perl v6.0.0 required.

- The Pugs::Compiler::Rule module must be properly installed.

An improperly installed Pugs::Compiler::Rule module would prevent the Perl 6 compiler from bootstrapping.

If that is the case, running Makefile.PL and make in Pugs::Compiler::Rule should fix the problem.

- The perl5 executable must have PMC support.

PMC support is required for loading precompiled Perl 6 files.

If you see the error below, it may happen that your perl was compiled without PMC support.

  Can't locate object method "compile" via package "Pugs::Compiler::Perl6"

Please see http://rt.cpan.org/Public/Bug/Display.html?id=20152

ENVIRONMENT VARIABLES

* PERL6LIB

Same usage as PERL5LIB - sets the search path for Perl 6 modules.

* V6DUMPAST

If set, the compiler will dump the syntax tree to STDOUT just before emitting code, using Data::Dumper.

* V6TIDY

If set, the compiler output will be much more readable, but there will be a lot of slowdown in compiler speed.

COMMAND LINE SWITCHES

* --compile-only

When using v6.pm from the command line, dumps the emitted code to STDOUT and then exit:

    $ perl -e 'use v6-alpha' - --compile-only ' 42.say '

    $ perl -Ilib lib/v6.pm --compile-only -e '<hello>.say;'

* -B

Selects alternate code generation backends.

The default is '-Bperl5:Pugs::Emitter::Perl6::Perl5'. '-Bperl5' also invokes the default backend.

    $ perl -e 'use v6-alpha' - --compile-only -Bperl5:MyEmitter ' 42.say '

The backend module must provide the emit($grammar, $ast) subroutine.

* -G

Selects alternate grammar frontends.

The default is '-Gperl5:Pugs::Grammar::Perl6'.

AUTHORS

The Pugs Team <perl6-compiler@perl.org>.

SEE ALSO

The Perl 6 homepage at http://dev.perl.org/perl6.

- the Perl 6 Synopsis: http://dev.perl.org/perl6/doc/synopsis.html.

The Pugs homepage at http://pugscode.org/.

The Parrot homepage at http://www.parrotcode.org.

COPYRIGHT

Copyright 2006 by Flavio Soibelmann Glock and others.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html