kids encyclopedia robot

Pugs (programming) facts for kids

Kids Encyclopedia Facts

Pugs is a compiler and interpreter for the Raku programming language, started on February 1, 2005, by Audrey Tang. (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 the Synopses. It is written in Haskell, 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.

Pugs is free software, distributable under the terms of either the GNU General Public License or the Artistic License. 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 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(<PGE Patrick>);
$sth.execute(<Pugs Audrey>);
$sth.execute(<Parrot Leo>);

my $res = $dbh.selectall_hashref('SELECT * FROM Test', 'Pumpking');
# Just another Pugs hacker
say "Just another $res<Audrey><Project> hacker";

See also

Kids robot.svg In Spanish: Pugs para niños

kids search engine
Pugs (programming) Facts for Kids. Kiddle Encyclopedia.