Weblog: Implementation
in Perl 6
|
|
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.
- 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.
Updated by Herbert Breunung on Jun 20 10:05am
Posted by Herbert Breunung on Feb 18 3:23pm
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.
Links
Updated by audreyt@hidden on Apr 16 6:44pm
Posted by pmichaud@hidden on Dec 28 10:25am
Updated by Herbert Breunung on Mar 24 5:09pm
Posted by Daniel Ruoso on Sep 3 11:07am
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.
Updated by Herbert Breunung on Mar 14 4:43pm
Posted by Herbert Breunung on Feb 25 3:30pm
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.
Updated by Martin Berends on Mar 13 3:18am
Posted by Herbert Breunung on Feb 22 4:45am
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.
Updated by Herbert Breunung on Mar 7 1:44pm
Posted by Herbert Breunung on Feb 21 5:04pm
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/
Updated by Herbert Breunung on Mar 6 1:07pm
Posted by Herbert Breunung on Feb 21 5:35pm
Historical Implementations
Topaz was Chip Salzenberg's attempt to reimplement Perl 5 in C++ in the late 1990s. Topaz was abandoned after the Coffee Mug Incident.
Simon Cozens tested around 2000 how to reimplement Perl.
(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.
Updated by Herbert Breunung on Mar 5 4:51am
Posted by Herbert Breunung on Feb 23 11:18am
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.
Updated by Herbert Breunung on Feb 27 5:42pm
Posted by Herbert Breunung on Feb 20 10:07am
Updated by Herbert Breunung on Feb 26 11:51am
Posted by particle on Jan 16 12:40pm
|
Weblog Navigation
Loading...
|