Quick jump:  What's new

 
Go to:
 
Weblog: Implementation 
in Perl 6
Implementations

There is no official or reference Perl 6 implementation, as exists with Perl 5. Instead, there is a language specification that began with Apocalypses and evolved through Exegeses and Synopses. There is also a test suite. The Synopses and test suite continuously evolve together with several compilers and interpreters. Larry Wall has clarified that anything that passes the test suite is Perl 6. With their feedback, the Synopses and test suite that form the language specification are evolving. This page is about the various partial implementations that exist, which can parse and execute Perl 6. Virtual machines and runloops are excluded because they do not deal with Perl 6 source code.

  • Rakudo is currently the most feature-rich and most actively developed implementation. It runs on Parrot, a virtual machine for many dynamic languages.
  • Niecza is currently the fastest implementation, the active development is lead by Stefan O'Rear.
  • Pugs was the leading implementation from 2005 until about 2007. It runs on GHC Haskell and helped to develop the test suite.
  • viv is a derivation of STD.pm for testing and bootstrapping purposes. A utility called "gimme5" creates viv by translating STD.pm into Perl 5. This is possible because Larry very carefully wrote STD.pm in a translatable subset of Perl 6.
  • Mildew is a Perl 5 based compiler that embeds viv, and can emit code for several runtime engines, including JavaScript and SMOP.
  • Sprixel started out with viv as the source code parser and Google's V8 JavaScript engine as a runtime interpreter. Currently Sprixel is undergoing a complete rewrite. The new version is being in C# and will probably run on both Mono and the .NET Framework. It will include its own regex engine and Perl 6 grammar parser.
  • Elf is a compiler written in Perl 6 with Perl 5 and Lisp backends.
  • vill connects STD.pm to the LLVM (Low Level Virtual Machine) compiler tools.
  • Perlito, formerly known as MP6 (mini Perl 6), is a Perl 6 subset build by Flavio Glock for bootstrap purposes.
  • v6 is a Perl 6 compiler for Perl 5.

Historical Implementations are definitely closed projects.

permalink
Pugs

Pugs is an implementation of Perl 6, started by the lovely Audrey Tang, that ended the long "Dark Ages" of a Perl 6 development without implementation. Its written in the purely functionel language Haskell, using the Glasgow Haskell Compiler (GHC). It aims to implement the full Perl6 specification, as detailed in the Synopses. It has a dual core structure that embeds an Perl 5 interpreter allowing to use CPAN modules inside Perl 6. The test suite was born as a part of the Pugs adventure as well as Elf, Perlito, KindaPerl6 and many others projects.

Status

Currently, the Pugs.hs project exists mainly for historical/archival purposes, not for active development.

The goal during this hiatus is to continue maintaining Pugs.hs, so it remains
installable with current and future editions of the Haskell Platform, and
interoperable with current and future releases of the Perl 5 Language.

permalink
mildew

What is mildew?

Mildew is a compiler that uses STD.pm as its parser and SMOP as its runtime. It's mainly developed by Pawel Murias and Daniel Ruoso.

What works?

The development of mildew is not feature-oriented, so we support a very small subset of the language features, but that is not really bad news. Mildew development is concept-oriented, so that means we fully support some Perl 6 concepts that are not yet supported by other implementations, like the "return" routine.

Mildew has its own test suite, which is located at http://svn.pugscode.org/pugs/v6/mildew/t/

Relevant features

p5 integration

http://svn.pugscode.org/pugs/v6/mildew/example/cgi.pl

return semantics

http://svn.pugscode.org/pugs/v6/mildew/t/return_function.t

exceptions

http://svn.pugscode.org/pugs/v6/mildew/t/throw_inside_catch.t

http://svn.pugscode.org/pugs/v6/mildew/t/control_exception.t

http://svn.pugscode.org/pugs/v6/mildew/t/fail.t

multi subs

http://svn.pugscode.org/pugs/v6/mildew/t/multi.t

roles

http://svn.pugscode.org/pugs/v6/mildew/t/role.t

.() overload and capture expansion

http://svn.pugscode.org/pugs/v6/mildew/t/capture_expansion.t

binding

http://svn.pugscode.org/pugs/v6/mildew/t/binding.t

meta-object-protocol

http://svn.pugscode.org/pugs/v6/mildew/t/classhow_add_method.t

http://svn.pugscode.org/pugs/v6/mildew/t/classhow_add_method_real.t

What doesn't work

Most of the spec is not yet implemented, take a look at the test suite to see what already works.

Source

http://svn.pugscode.org/pugs/v6/mildew/

permalink
v6

Incredibly, an effort lead by Flávio Soibelmann Glock is working to actually implement Perl 6 in Perl 5. You can download v6 now on CPAN to try it out. Its feature set has not caught up with pugs yet, but there is steady progress on it.

Perl 6 features are also coming to Perl 5 in other ways, see Perl 6 for Perl 5.

permalink
viv

The 'viv' utility is a Perl 5 based way to experiment with STD.pm, the still evolving "official" Perl 6 grammar, written in Perl 6. STD.pm can parse Perl 6 source code, check it for correct syntax and semantics, and convert it to an abstract syntax tree.

The chicken-or-egg bootstrap problem is how to use STD.pm on a computer that does not have a Perl 6 to run it. None of the current (March 2010) Perl 6 implementations (Rakudo, Pugs etc) can handle STD.pm, because amongst other things it uses Longest Token Matching (LTM), a feature of Perl 6 grammars that is particularly difficult to implement in a general purpose parser.

A utility called 'gimme5' http://svn.pugscode.org/pugs/src/perl6/gimme5 comes to the rescue. Larry wrote 'gimme5' in Perl 5 to translate a subset of Perl 6 grammars into Perl 5 language. The STD.pm 'make' command uses 'gimme5' to translate STD.pm into 'STD.pm5'. Another step then converts 'STD.pm5' to 'STD.pmc'. Larry ensures that STD.pm is written in just a translatable subset of Perl 6, so that 'gimme5' can handle it. He also causes 'viv' to emulate Longest Token Matching, by carefully arranging the sequence of tokens where they occur as alternatives in STD.pm. The result is that longer tokens occur and match before shorter ones.

Unfortunately, 'viv' is not equipped to execute the code. Other language tools such as Mildew extend 'viv' further and may be able to do that.

permalink
Sprixel

The name is a cute anagram of "Perl six". There is an existing but dormant version, and a radically different to-be-released version.

Matthew Wilson (diakopter) has prototyped several Perl 6 implementations. His fourth one started out being called "vijs", because it connected the viv language parser to a runtime interpreter written in JavaScript. Along the way it got renamed to "Sprixel". The JavaScript is executed by the V8 Just-In-Time (JIT) compiler and runtime, the one that makes the Google Chrome browser so fast. Sprixel runs in text only mode, or with any web browser.

The main Sprixel program is written in Perl 5. It embeds viv and calls that to convert a Perl 6 program to an Abstract Syntax Tree. Viv stores the AST in a data structure of nested Perl 5 hashes and arrays. A Sprixel module strips that AST to the bare essentials and serializes it to JSON format. Sprixel then starts the V8 JavaScript processor, passing it runtime code and the AST-in-JSON text. The runtime code loads the AST, and then interprets the code it contains.

So the Sprixel currently available at http://svn.pugscode.org/pugs/src/perl6/sprixel is an AST interpreter, but a fairly quick one when run on V8.

Development of this version of Sprixel stalled because implementing the complex features of Perl 6 in JavaScript became increasingly difficult. Also, diakopter wanted more speed than viv was ever going to give.

After several months of experimentation diakopter settled on C# as the new implementation language, to run on both the Mono and the .NET virtual machines. The new Sprixel will embed a utility called RunSharp to dynamically generate bytecode that gets JIT compiled to native machine code before being executed. It will also contain its own regex and grammar engine, and will probably have its own derived variant of STD.pm for the Perl 6 language definition. The microbenchmarks published in #perl6 so far promise extremely fast parsing and execution performance.

permalink
Perlito

Formerly known as MiniPerl 6. It's a small subset of Perl 6, helping to bootstrap other high level languages (HLL), pretty much like NQP. Perlito is grown out of the Pugs project and is mainly developed by Flavio S. Glock.

http://www.perlito.org/

permalink
Historical Implementations

Topaz

Topaz was Chip Salzenberg's attempt to reimplement Perl 5 in C++ in the late 1990s. Topaz was abandoned after the Coffee Mug Incident.

Sapphire

Simon Cozens tested around 2000 how to reimplement Perl.

Ponie

(Perl (5) On New Interpreter Engine) had aimed to implement the Perl 5 language on Parrot. It was developed 2003-2006 by Arthur Bergman and Nicholas Clark. Ponie had the potential to integrate Perl 6 and Perl 5 code in the same process. That would have been useful for language bootstrap purposes, and also to make lots of the Perl 5 based CPAN libraries available to Perl 6 users. Some thought at one point even it might become Perl 5.10.. It was discontinued because emulating all of the idiosyncracies of Perl 5 was daunting, and the developers were presumably daunted.

permalink
Elf

A Perl 6 compiler written in Perl 6 itself, started by Mitchell Charity.

(well, the elf mostly-compatible-subset of p6). elf_h in http://svn.pugscode.org/pugs/misc/elf/ is a stand-alone p5 program, namely elf compiled to p5. the elfish/on_sbcl just swaps out the emitter. so elf_on_p5 can compile to p5 and to cl (depending on the emitter used), and so can elf_on_sbcl.

permalink
Rakudo

The Rakudo Perl 6 Compiler ("rakudo" for short) targets the Parrot Virtual Machine, and it currently lives on github. Its developed by Patrick Michaud (pmichaud - lead developer), Jonathan Worthington (jnthn), Stephen Weeks and others, mostly using NQP. It will most likely become the "official" Perl 6.0 release.

To build the Rakudo Perl 6 compiler, follow the instructions on the official homepage.
Parrot and Rakudo change rapidly; if you have issues with the latest point release, be sure to try svn/git-latest of parrot/rakudo.

Also check out Getting Involved to learn about how to help with development, and see A Guide to the Pugs Repository for Rakudo Hackers.

permalink
Weblog Navigation
Loading...
Weblog Archives
  • Loading...

Upload Files

Click "Browse" to find the file you want to upload. When you click "Upload file" your file will be uploaded and added to the list of attachments for this page.

Maximum file size: 50MB

 
 
 
File Name Author Date Uploaded Size

Save Page As

Enter a meaningful and distinctive title for your page.

Page Title:

Tip: You'll be able to find this page later by using the title you choose.

Page Already Exists

There is already a page named XXX. Would you like to:

Save with a different name:

Save the page with the name "XXX"

Append your text to the bottom of the existing page named: "XXX"

Upload Files

Click "Browse" to find the file you want to upload. When you click "Add file" this file will be added to the list of attachments for this page, and uploaded when you save the page.

 
 
 
Add Tags

Enter a tag and click "Add tag". The tag will be saved when you save the page.

Tag: 

Suggestions: