Pugs is an interpreter (computing) and Compiler for the Perl 6 programming language, started on February 1st 2005 by Autrijus Tang.
= Overview =
The Pugs project aims to .
Pugs includes two main executables:
pugs is the interpreter with an interactive shell.
pugscc can compile Perl 6 programs into Haskell code, or Parrot virtual machine s intermediate code (IMC).
= Version numbering =
The major/minor version numbers of Pugs converges to 2 × π (being reminiscent of TeX and METAFONT, which use similar scheme); each significant digit in the minor version represents a successfully completed milestone. The third digit is incremented for each release. The current milestones are:
6.0: Initial release.
6.2: Basic IO and control flow elements; mutable variables; assignment.
6.28: Classes and traits.
6.283: Rules and Grammars.
6.2831: Type system and linking.
6.28318: Macros.
6.283185: Port Pugs to Perl 6, if needed.
= Perl 5 compatibility =
As of version 6.2.6, Pugs also has the ability to embed Perl 5 and use CPAN modules installed on the system. The example below show a use of the popular Perl DBI module to manage a SQLite database:
#!/usr/bin/pugs
use v6;
use perl5:DBI;
my $dbh = DBI.connect( dbi:SQLite:dbname=test.db );
$dbh.do( CREATE TABLE Test (Project, Pumpking) );
my $sth = $dbh.prepare( INSERT INTO Test VALUES (, ) );
$sth.execute();
$sth.execute();
$sth.execute();
my $res = $dbh.selectall_hashref( SELECT * FROM Test , Pumpking );
# Just another Pugs hacker
say Just another $res hacker ;
= Development model =
Pugs has been praised as a particularly successful open-source project. Started at the beginning of 2005, progress has been rapid. Several factors have been suggested as reasons:
Pugs s use of Haskell. Haskell s static typing means that a wider range of bugs are detected by the compiler at compile-time. In the tradition of functional languages, it appears that a few lines of Haskell can do a lot, especially in the basics of language parsing and execution. Things get marginally trickier around the edges, where the functional code has to interact with the real (time-oriented) world. To achieve this, Pugs makes extensive use of monads, which are containers for side-effects in a language without side-effects (purely Functional languages).
Test-driven development. A feature of Extreme Programming, the aim is to ensure that absolutely everything has test code, probably long before the real code is written. It s then apparent what the state of the project is, simply from how many tests are passing or failing. It also makes it much easier to detect regressions. Originally there was hope that the huge Pugs test suite would form the basis of the actual Perl 6 test suite, but now it looks more like Pugs itself will form the basis of the actual Perl 6, so the point is a bit moot.
Autrijus liberal sprinkling of the commit bit. Pugs development is currently based around a Subversion repository, and access is given out quite freely - especially to people wishing to write tests. Because of this, a huge library of tests has accumulated.
Autrijus enthusiastic and frequent communications. His blog (linked below) attracted many people to the project, mainly due to the astonishing pace of development. There s also usually a community on the #perl6 Freenode IRC channel.
= External links =
[http://www.pugscode.org pugscode.org - Pugs homepage]
[http://use.perl.org/journal.plop=display&uid=1505 Journal of Autrijus]
[http://www.oreillynet.com/pub/wlg/7996 -Ofun: Optimizing for Fun]
[http://search.cpan.org/~autrijus/Perl6-Pugs/ Perl6::Pugs on CPAN]
[http://www.nntp.perl.org/group/perl.perl6.language/19263 Kudos to Autrijus]