is a Compiler and Interpreter for the Perl 6 Programming Language , started on February 1 st 2005 by Audrey Tang .
The Pugs project aims to , specifically targeting the Glasgow Haskell Compiler .
Pugs includes two main executables:
- ''pugs'' is the interpreter with an interactive shell.
- ''pugscc'' can compile Perl 6 programs into Haskell code, Perl 5, JavaScript , or Parrot Virtual Machine 's PIR assembly.
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.
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 Resource id #7 = DBI.connect('dbi:SQLite:dbname=test.db');
Resource id #7.do("CREATE TABLE Test (Project, Pumpking)");
my = Resource id #7.prepare("INSERT INTO Test VALUES (?, ?)");
.execute();
.execute();
.execute();
- FROM Test', 'Pumpking');
# Just another Pugs hacker
say "Just another hacker";
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' 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 ).
- Test-driven Methodology . 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.
- Audrey's liberal sprinkling of the Commit Bit . Pugs development is currently based around a Subversion (software) 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.
- Audrey's enthusiastic and frequent communications. Her journal (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.
|