v6 - An experimental Perl 6 implementation


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

    $ perl

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' can also be used as a plain program. This examples assume that is in the ./lib directory:

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

Print the version banner:

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


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. 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.


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

This is a valid header:

    use v6-alpha;

* it executes perl5

* perl5 will call the module.

This is an invalid header:

    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



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


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


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


* --compile-only

When using 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/ --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'.


The Pugs Team <>.


The Perl 6 homepage at

- the Perl 6 Synopsis:

The Pugs homepage at

The Parrot homepage at


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.