Pugs is a
compiler
In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
and
interpreter for the
Raku programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming l ...
, started on February 1, 2005, by
Audrey Tang
Audrey Tang ( zh, t=唐鳳, p=Táng Fèng; born 18 April 1981) is a Taiwanese free software programmer and the inaugural Minister of Digital Affairs of the Republic of China (Taiwan), who has been described as one of the "ten greatest Taiwanese c ...
. (At the time, Raku was known as Perl 6.)
Pugs development is now placed on hiatus, with most Raku implementation efforts now taking place on
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, specifically targeting the
Glasgow Haskell Compiler
The Glasgow Haskell Compiler (GHC) is an open-source native code compiler for the functional programming language Haskell.
It provides a cross-platform environment for the writing and testing of Haskell code and it supports numerous extension ...
.
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 that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
, or
Parrot virtual machine's
PIR
Pir or PIR may refer to:
Places
* Pir, Kerman, a village in Kerman Province, Iran
* Pir, Satu Mare, commune in Satu Mare County, Romania
Religion
* Pir (Alevism), one of the 12 ranks of Imam in Alevism
* Pir (Sufism), a Sufi teacher or spiritu ...
assembly.
Pugs is
free software
Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty, ...
, distributable under the terms of either the
GNU General Public License
The GNU General Public License (GNU GPL or simply GPL) is a series of widely used free software licenses that guarantee end user
In product development, an end user (sometimes end-user) is a person who ultimately uses or is intended to ulti ...
or the
Artistic License
Artistic license (alongside more contextually-specific derivative terms such as poetic license, historical license, dramatic license, and narrative license) refers to deviation from fact or form for artistic purposes. It can include the alterat ...
.
Pugs Apocryphon 1
/ref> These are the same terms as Perl.
Version numbering
The major/minor version numbers of Pugs converges to 2π (being reminiscent of TeX 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
The Comprehensive Perl Archive Network (CPAN) is a repository of over 250,000 software modules and accompanying documentation for 39,000 distributions, written in the Perl programming language by over 12,000 contributors. ''CPAN'' can denote eith ...
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
In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
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 Monads in functional programming, monadic combinatorial
Combinatorics is an area of mathematics primarily concerned with counting, both as a means and an end in obtaining results, and certain properties of finite structures. It is closely related to many other areas of mathematics and has many ap ...
parser written entirely in Haskell, simplifies parsing. Because Haskell is a purely functional language, making the functional code interact with the real world (inputs/outputs and time-driven environment) requires thought. To achieve this, Pugs makes extensive use of monads.
* Pugs's use of test-driven methodology (a tenet of Extreme Programming
Extreme programming (XP) is a software development methodology intended to improve software quality and responsiveness to changing customer requirements. As a type of agile software development,"Human Centred Technology Workshop 2006 ", 2006, P ...
). 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
In the context of software engineering, software quality refers to two related but distinct notions:
* Software functional quality reflects how well it complies with or conforms to a given design, based on functional requirements or specification ...
. 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
A committer is an individual who is permitted to modify the source code of a software project, that will be used in the project's official releases. To contribute source code to most large software projects, one must make modifications and then " ...
. 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 transform the established social order and its structures of power, authority, hierarchy, and social norms. Sub ...
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 (in North America) or elk (in Eurasia) (''Alces alces'') is a member of the New World deer subfamily and is the only species in the genus ''Alces''. It is the largest and heaviest extant species in the deer family. Most adult ma ...
project.
References
External links
*
pugscode.org - Pugs homepage
Pugs Journal
-Ofun: Optimizing for Fun
Perl6::Pugs on CPAN
Kudos from Perl 6 Design Team
{{Perl
Raku (programming language)
Free compilers and interpreters
Free software programmed in Haskell