Pugs is a
compiler
In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
and
interpreter for the
Raku programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
, begun on 1 February 2005, by
Audrey Tang. Raku was then called Perl 6.
As of 21 April 2010, Pugs development was placed on hiatus, with most Raku implementation efforts moving to
Rakudo.
Overview
The Pugs project aimed to
bootstrap Perl 6 by implementing the full Perl 6 specification, as detailed in th
Synopses It is written in
Haskell
Haskell () is a general-purpose, statically typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research, and industrial applications, Haskell pioneered several programming language ...
, 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
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
, or
Parrot virtual machine's
Parrot intermediate representation (PIR)
assembly language
In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
.
Pugs is
free and open-source software
Free and open-source software (FOSS) is software available under a license that grants users the right to use, modify, and distribute the software modified or not to everyone free of charge. FOSS is an inclusive umbrella term encompassing free ...
, distributable under the terms of either the
GNU General Public License
The GNU General Public Licenses (GNU GPL or simply GPL) are a series of widely used free software licenses, or ''copyleft'' licenses, that guarantee end users the freedom to run, study, share, or modify the software. The GPL was the first ...
or the
Artistic License.
These are the same terms as Perl.
Version numbering
The major/minor version numbers of Pugs converge to 2π (being reminiscent of
TeX
Tex, TeX, TEX, may refer to:
People and fictional characters
* Tex (nickname), a list of people and fictional characters with the nickname
* Tex Earnhardt (1930–2020), U.S. businessman
* Joe Tex (1933–1982), stage name of American soul singer ...
and
Metafont, which use a 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 demonstrates the use of the popular
Perl DBI module to manage a 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
Several factors have been suggested as reasons for Pugs's progress:
* Haskell's
static typing can make it easier for program bugs to be detected at compile time. Haskell code is also often thought to be concise. The Parsec librar
a
Monad (functional programming), monadic combinatorial parser written fully in Haskell, simplifies parsing. Because Haskell is a
purely functional programming
In computer science, purely functional programming usually designates a programming paradigm—a style of building the structure and elements of computer programs—that treats all computation as the evaluation of function (mathematics), mathematic ...
language, making the functional code interact with the real world (
input/output
In computing, input/output (I/O, i/o, or informally io or IO) is the communication between an information processing system, such as a computer, and the outside world, such as another computer system, peripherals, or a human operator. Inputs a ...
and time-driven environment) requires thought. To achieve this, Pugs makes extensive use of
monads.
* Pugs's use of
test-driven development methodology (a tenet of
Extreme Programming). This methodology dictates that every module should have test code, even before the modules are implemented. Advocates of this methodology argue that it improves
software quality. However, the project often silenced failed regression tests before releases, removing much of the benefit of test-driven development.
* Tang's liberal granting of the
commit bit. Pugs development is currently based around a
Subversion
Subversion () refers to a process by which the values and principles of a system in place are contradicted or reversed in an attempt to sabotage the established social order and its structures of Power (philosophy), power, authority, tradition, h ...
repository, and access is freely given, especially to people wishing to write tests. Because of this, a huge library of tests has accumulated. Other Perl 6 implementations rely on many tests developed for Pugs as an executable specification for Perl 6.
* Tang's communication style; her journal (linked below) attracted many people to the project.
Despite these factors, progress on the Haskell implementation stalled in late 2006, as personal issues kept Audrey from devoting as much time to the project as she had in 2005.
Many Pugs contributors have since moved on to implement Perl6-inspired systems as CPAN modules on Perl 5, such as the
Moose
The moose (: 'moose'; used in North America) or elk (: 'elk' or 'elks'; used in Eurasia) (''Alces alces'') is the world's tallest, largest and heaviest extant species of deer and the only species in the genus ''Alces''. It is also the tal ...
project.
References
External links
pugscode.org: PugsPugs JournalOfun: Optimizing for Fun
Perl6::Pugs on CPANKudos from Perl 6 Design Team
{{Portal bar, Free and open-source software
Raku (programming language)
Free and open source compilers
Free and open source interpreters
Free software programmed in Haskell
Articles with example Perl code