root/docs/01Overview.html

Revision 16694, 17.4 kB (checked in by Darren_Duncan, 18 months ago)

the Pugs main license is now simply Artistic 2.0 (final) rather than Artistic 2.0b5 disjoint GPL

  • Property svn:mime-type set to text/html; charset=UTF-8
  • Property svn:eol-style set to native
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html lang="en">
3<head>
4  <link href="perl.css" rel="stylesheet" type="text/css">
5  <meta content="text/html; charset=UTF-8" http-equiv="content-type">
6  <title>Pugs Apocryphon 1</title>
7  <meta content="Audrey Tang" name="author">
8</head>
9<body>
10<h1 style="text-align: left; line-height: normal;" align="left">
11Pugs
12Apocryphon 1<br>
13<span style="font-weight: normal;">Overview
14of the Pugs project</span></h1>
15<h2>
16What is this document about?</h2>
17<p>
18The <a href="http://svn.perl.org/perl6/pugs/trunk/docs/">Pugs
19Apocrypha</a>
20are a series of documents, written in question/answer format, to
21explain the
22design and implementation of Pugs. This document (PA01) is a
23higher-level
24overview of the project.</p>
25<h2>
26What is Pugs?</h2>
27<p>
28Started in February 2005, <a href="http://pugscode.org/">Pugs</a>
29is an implementation of the Perl 6
30language. <a href="http://use.perl.org/%7Eautrijus/journal/">Autrijus
31Tang</a> is responsible for the
32design and development of Pugs with help from a group of committers and
33contributors.</p>
34<h2>
35What is Perl 6?</h2>
36<p>
37<a href="http://dev.perl.org/perl6/">Perl
386</a>
39is the next major revision of Perl, a context-sensitive,
40multi-paradigmatic, <i>practical</i>
41programming language, designed by a team led by Larry Wall. The Pugs
42project
43has been <a
44 href="http://www.nntp.perl.org/group/perl.perl6.language/19263">enthusiastically
45welcomed</a> by the Perl 6 team.</p>
46<h2>
47Is Pugs the official Perl 6?</h2>
48<p>
49Official Perl 6 is now defined as any implementation which passes the
50Perl 6 testsuite.  So Pugs is expected to be an official Perl 6, but
51not necessarily the only one.</p>
52<h2>
53Has Perl 6 been specified?</h2>
54<p>
55By December 2004, most of Perl 6 had
56been
57specified as a series of <a href="http://dev.perl.org/perl6/synopsis/">Synopses</a>.
58Although not considered final, it is now stable enough to be
59implemented. Many
60of the Synopses are based on Larry's <a
61 href="http://dev.perl.org/perl6/apocalypse/">Apocalypses</a>.
62Sometimes the
63design team releases <a href="http://dev.perl.org/perl6/exegesis/">Exegeses</a>,
64which explain the meaning of Apocalypses. Pugs adheres to
65the Synopses, referring to Apocalypses or
66Exegeses when a Synopsis is unclear or imprecise.</p>
67<h2>
68What does
69&ldquo;Apocrypha&rdquo; mean?</h2>
70<p>
71The word <a href="http://en.wikipedia.org/wiki/Apocrypha">Apocrypha</a>,
72from the Greek
73&alpha;&pi;ό&kappa;&rho;&upsilon;&phi;&omicron;&sigmaf;,
74&ldquo;hidden&rdquo;, refers to religious works that are not
75considered
76canonical, or part of officially accepted scripture. The proper
77singular form
78in Greek is <i>Apocryphon</i>.</p>
79<h2>
80What is the relationship between
81Apocrypha and the Perl 6
82design documents?</h2>
83<p>
84Apocalypses and Synopses cover the Perl
856
86language in general; Apocrypha are specific to the Pugs implementation.
87Like <a href="http://www.parrotcode.org/docs/pdd/">Parrot
88Design Documents</a>, Apocrypha
89will be constantly updated according to the status of Pugs.</p>
90<h2>
91Will Pugs implement the full Perl 6
92specification?</h2>
93<p>
94Yes. Pugs always targets the latest
95revision of Perl 6 Synopses. As soon as a new revision or a new
96Synopsis is published,
97incompatibilities between Pugs and the new version will be considered
98bugs in
99Pugs.</p>
100<h2>
101Is Pugs free software?</h2>
102<p>
103Yes. It is available under the <a
104 href="http://svn.pugscode.org/pugs/LICENSE/Artistic-2">Artistic
105License version 2.0</a>.</p>
106<h2>
107Is Pugs funded by the Perl Foundation?</h2>
108<p>
109No. After receiving three <a
110 href="http://www.perlfoundation.org/gc/grants/2003_autrijus.html">Perl
111Foundation grants</a> on various
112projects, Autrijus decides it would be more
113helpful to donate time to the Perl 6 project by hacking Pugs, rather
114than
115asking TPF for money to do the same thing.</p>
116<h2>
117Where can I download Pugs?</h2>
118<p>
119For the very latest version of Pugs,
120check
121out the source from <a href="http://svn.pugscode.org/pugs/">Subversion</a>
122or <a href="http://wagner.elixus.org/%7Eautrijus/darcs/pugs">darcs</a>
123repositories. Periodic releases are available on CPAN
124under the <a href="http://search.cpan.org/dist/Perl6-Pugs/">Perl6-Pugs</a>
125namespace.
126(By the way, if you'd like offline working with the Subversion
127repository, the <a href="http://svk.elixus.org/">svk</a>
128client may be of interest. But using
129vanilla svn is fine.)</p>
130<h2>
131How do I build Pugs?</h2>
132<p>
133Pugs uses the standard Makefile.PL build
134system, as detailed in the <a
135 href="http://svn.pugscode.org/pugs/README"><code>README</code></a>
136file. Since Pugs is written in Haskell, you will need <a
137 href="http://haskell.org/ghc/">Glasgow Haskell
138Compiler</a> (GHC) 6.4 or above.
139Please download a <a href="http://haskell.org/ghc/">binary build</a>
140for your
141platform; compiling GHC from source code can take a very long time.</p>
142<h2>
143What is Haskell?</h2>
144<p>
145<a href="http://haskell.org/">Haskell</a>
146is a standardized, purely functional programming language with
147built-in <a href="http://en.wikipedia.org/wiki/Lazy_evaluation">lazy
148evaluation</a>
149capabilities. While there are several different implementations
150available,
151currently Pugs needs to be built with GHC, because it uses several
152GHC-specific
153features.</p>
154<h2>
155What is GHC?</h2>
156<p>
157GHC is a state-of-the-art compiler and
158interactive
159environment, available under a <a
160 href="http://haskell.org/ghc/license.html">BSD-style
161license</a>. Itself written in
162Haskell, GHC can compile Haskell to bytecode, C
163code, and machine code on some platforms. GHC has an extensive library,
164numerous language extensions, and a very capable optimizer (with some
165help from
166a <a
167 href="http://www.cse.unsw.edu.au/%7Echak/haskell/ghc/comm/the-beast/mangler.html">Perl
1685 program</a>). As such, it provides
169an excellent platform to solve Perl 6&rsquo;s <i>bootstrapping
170problem</i>.</p>
171<h2>
172What is the Perl 6 bootstrapping problem?</h2>
173<p>
174The goal of the Perl 6 project is to be <i>self-hosting</i>:
175The Perl 6 compiler needs to be written in Perl 6 itself, and must
176parse Perl 6
177source code with Perl 6 Rules, which is a subset of the Perl 6
178language. The
179generated code must also contain an evaluator that can execute Perl 6
180code on
181the fly. The only way to break this cycle of dependency is by first
182implementing some parts in other languages, then rewrite those parts in
183Perl 6.</p>
184<h2>
185What was the initial bootstrapping plan?</h2>
186<p>
187According to the <a
188 href="http://search.cpan.org/dist/parrot/docs/faq.pod#Isn%27t_there_a_bootstrapping_problem?">Parrot
189FAQ</a>, the initial plan was to
190bootstrap via Perl 5: First we extend Perl 5
191to run on the Parrot virtual machine (via <code>B::Parrot</code>
192or <a href="http://www.poniecode.org/">Ponie</a>),
193and then implement the Perl 6
194compiler in Perl 5, which will be translated to Perl 6 via a p5-to-p6
195translator. However, although part of the Rule system was prototyped in
196Perl 5
197as <a
198 href="http://search.cpan.org/dist/Perl6-Rules/"><code>Perl6::Rules</code></a>,
199it was not mature enough to build a compiler on. As such, the plan was revised
200to bootstrap via C instead.</p>
201<h2>
202What was the revised bootstrapping plan?</h2>
203<p>
204According to an early 2005 <a
205 href="http://www.perlfoundation.org/gc/grants/2005-p6-proposal.html">proposal</a>,
206the plan is to first implement the Rule engine in C (i.e. <a
207 href="http://svn.perl.org/viewcvs/parrot/trunk/compilers/pge/">PGE</a>),
208use it to parse Perl 6 into Parrot as an <a
209 href="http://en.wikipedia.org/wiki/Abstract_syntax_tree">abstract
210syntax tree</a>
211(AST), and then implement an AST evaluator as part of Parrot. Ponie and
212p5-to-p6 are still in progress, but they are no longer critical
213dependencies in
214the
215bootstrapping process.</p>
216<h2>
217How can Pugs help Perl 6 to bootstrap?</h2>
218<p>
219In a bootstrapping process, there are
220often
221many bottlenecks, which prevent people from working on things that
222depend on
223them. For example, one cannot easily write unit tests and standard
224libraries
225for Perl 6 without a working Perl 6 implementation, or work on an AST
226evaluator
227without an AST interface. Pugs solves such deadlocks by providing ready
228substitutes
229at various levels of the process.</p>
230<h2>
231How can Pugs help the Perl 6 language
232design?</h2>
233<p>
234Without a working implementation, it is very hard to spot
235inconsistencies and corner cases in the specification.
236However,
237if a design problem is found late into the implementation, it may
238require
239costly re-architecture for everything else. By providing a working Perl
2406
241implementation, Pugs can serve as a proving ground to resolve problems
242as early
243as possible, as well as encourage more people to exercise Perl
2446&rsquo;s features.</p>
245<h2>
246Why did you choose Haskell?</h2>
247<p>
248Many Perl 6 features have similar
249counterparts in Haskell: Perl 6 Rules corresponds closely to <a
250 href="http://www.cs.uu.nl/%7Edaan/download/parsec/parsec.html">Parsec</a>;
251lazy
252list evaluation is common in both languages; continuation support can
253be
254modeled with the <a
255 href="http://www.nomaware.com/monads/html/contmonad.html">ContT</a>
256monad transformer, and so on. This greatly simplified the prototyping
257effort:
258the first working interpreter was released within the <a
259 href="http://use.perl.org/%7Eautrijus/journal/23051">first
260week</a>, and by the <a
261 href="http://use.perl.org/%7Eautrijus/journal/23335">third
262week</a> we had a full-fledged <a
263 href="http://svn.pugscode.org/pugs/ext/Test/lib/Test.pm"><code>Test.pm</code></a>
264module for unit testing.</p>
265<h2>
266Is Pugs a compiler or an interpreter?</h2>
267<p>
268Similar to Perl 5, Pugs first compiles
269Perl
2706 program to an AST, then executes it using the built-in evaluator.
271However, in
272the future Pugs may also provide a compiler interface that supports
273different
274compiler backends.</p>
275<h2>
276Which compiler backends do you have in
277mind?</h2>
278<p>
279If implemented, the first compiler
280backend
281will likely generate Perl 6 code, similar to the <a
282 href="http://search.cpan.org/dist/perl/ext/B/B/Deparse.pm"><code>B::Deparse</code></a>
283module. The next one may generate
284Haskell code, which can then be
285compiled to C by GHC. At that point, it may make sense to target the <a
286 href="http://svn.perl.org/viewcvs/parrot/trunk/compilers/ast/">Parrot
287AST</a>
288interface. We can also add other backends (such as Perl 5 bytecode) if
289people
290are willing to work on them.</p>
291<h2>
292Do you have a roadmap for Pugs
293development?</h2>
294<p>
295The major/minor version numbers of Pugs
296converges to 2*&pi;; each significant digit in the minor version
297represents a
298milestone. The third digit is incremented for each release. The current
299milestones are:</p>
300<ul>
301  <li>6.0: Initial release.</li>
302  <li>6.2: Basic IO and control
303flow
304elements; mutable variables; assignment.</li>
305  <li>6.28: Classes and traits.</li>
306  <li>6.283: Rules and Grammars.</li>
307  <li>6.2831: Type system and linking.</li>
308  <li>6.28318: Macros.</li>
309  <li>6.283185: Port Pugs to
310Perl 6,
311if
312needed.</li>
313</ul>
314<h2>
315How portable is Pugs?</h2>
316<p>
317Pugs runs on Win32, Linux and many
318flavors
319of Unix systems. See GHC&rsquo;s <a
320 href="http://haskell.org/ghc/contributors.html">porters
321list</a> and <a href="http://haskell.org/ghc/download_ghc_622.html">download
322page</a> for details. Starting from
3236.2.0, the Pugs team will also provide
324binary builds on selected platforms.</p>
325<h2>
326How fast is Pugs?</h2>
327<p>
328The parser part of Pugs is very fast,
329due
330to its robust underpinning in Parsec. However, the Pugs evaluator is
331currently
332not optimized at all: dispatching is around 1000 operators per second
333on a
334typical PC, which is nearly 100 times slower than Perl 5. Still, it is
335fast
336enough for prototyping language features; if you need fast operations
337in Pugs,
338please consider helping out the Compiler backend.</p>
339<h2>
340Is there a CPAN for Perl 6 modules?</h2>
341<p>
342No. The current preferred method for submitting Perl 6/Pugs modules is to
343ask for a committer bit at http://commitbit.pugscode.org/ and to add your
344module to the Pugs source tree under the modules/ directory. It is also
345helpful to include test suites with your modules as well, so we can know
346when they work.
347</P>
348<P>
349However, all is not lost. If you are patient you can wait for
350<code>Pugs::MakeMaker</code> and <code>Module::Install::Pugs</code> to come out
351on CPAN. Once they are available individually on CPAN, you can begin submitting
352things to CPAN, because that means we've figured out the distribution problem.
353Of course, suggestions are always welcome.
354</p>
355<h2>
356Can Pugs work with Perl 5 libraries?</h2>
357<p>
358Yes, Pugs can work with Perl 5 libraries.  This requires that Pugs be
359compiled with Perl 5 embedding.  Pugs understands Perl 5 objects, classes
360and functions.  Pugs objects, classes and functions are also understood by
361Perl 5.  As such, these types can be used in round-trip callbacks.</p>
362
363<p>Examples of working with Perl 5 may be found <a href="http://svn.pugscode.org/pugs/t/unspecced/p5/">in the source
364tree</a>.
365<h2>
366Can Pugs work with Haskell libraries?</h2>
367<p>Pugs can be compiled with <a
368href="http://www.cse.unsw.edu.au/%7Edons/hs-plugins/"><code>hs-plugins</code></a>
369 support, which allows it to use Haskell libraries.  It is also capable of
370 dynamically loading Haskell modules.  Aside from this, inline Haskell can
371 be evaluated using <code>eval('...', :lang&lt;haskell&gt;)</code>.</p>
372<p>In addition, at the basic level, you can statically link Haskell libraries
373into Pugs primitives, by modifying a few lines in <a
374 href="http://svn.pugscode.org/pugs/src/Pugs/Prim.hs"><code>Prim.hs</code></a>.
375</p>
376<h2>
377Can Pugs work with C libraries?</h2>
378<p>
379Not yet. However, <a href="http://www.haskell.org/hdirect/">HaskellDirect</a>
380seems to provide an
381easy way to interface with C, CORBA and COM libraries, especially when
382combined
383with hs-plugins described above.</p>
384<h2>
385I know Perl 5, but not Haskell. Can I
386develop Pugs?</h2>
387<p>
388Sure! The standard libraries and unit
389tests
390that come with Pugs are coded in Perl 6, and there is always a need for
391more
392tests and libraries. All you need is basic familiarity of Perl 5, and a
393few
394minutes to get acquainted with some small syntax changes. You will
395likely pick
396up some Haskell knowledge along the way, too.</p>
397<h2>
398I know Haskell, but not Perl 5. Can I
399develop Pugs?</h2>
400<p>
401Sure! Perl 6 and Haskell have many
402things
403in common, such as type-based function dispatch, first class functions
404and
405currying, so picking up the syntax is relatively easy. Since there are
406always
407some TODO tests for features in need of implementation, it is never
408hard to
409find something to do.</p>
410<h2>
411I have learned some Perl 6. What can I
412do with Pugs?</h2>
413<p>
414Look at the examples/ directory to see
415some
416sample programs. Some people are already writing web applications and
417report
418systems with Pugs. If you run into a missing feature in Pugs, please
419let us
420know so we can implement it.</p>
421<h2>
422Where can I learn more about Haskell?</h2>
423<p>
424The <a href="http://www.haskell.org/">Haskell
425homepage</a> and the <a href="http://haskell.org/hawiki/">Wiki</a>
426are good
427entry points. Of the many online tutorials, <a
428 href="http://www.isi.edu/%7Ehdaume/htut/">Yet Another
429Haskell Tutorial</a> is
430perhaps the most accessible. Due to the ubiquitous use of Monad
431transformers in
432Pugs, <a href="http://www.nomaware.com/monads/html/">All About
433Monads</a> is
434also recommended. For books, <a
435 href="http://www.iro.umontreal.ca/%7Elapalme/Algorithms-functional.html">Algorithms:
436A Functional Programming Approach</a>,
437<a href="http://www.cs.kent.ac.uk/people/staff/sjt/craft2e/">Haskell:
438The Craft of
439Functional Programming</a> and <a href="http://haskell.org/soe/">The
440Haskell School of
441Expression</a>
442are
443fine introductory materials. Finally, the
444<a href="irc://irc.freenode.net/haskell"><code>#haskell</code> channel</a> on
445<a href="http://freenode.net/">irc.freenode.net</a> is full of helpful and
446 interesting people.</p>
447<h2>
448Where can I learn more about Perl 6?</h2>
449<p>
450The <a href="http://dev.perl.org/perl6/">Perl
4516 homepage</a> provides many online
452documents. Every week or two, a new Perl 6
453list summary will appear on <a href="http://www.perl.com/">Perl.com</a>;
454it is
455a must-read for people who wish to follow Perl 6&rsquo;s progress.
456For books, <a href="http://www.oreilly.com/catalog/059600737X/">Perl
4576 and Parrot Essentials</a>
458and <a href="http://www.apress.com/book/bookDisplay.html?bID=355">Perl
4596 Now</a>
460are both helpful.</p>
461<h2>
462Where can I learn more about
463implementing programming
464languages?</h2>
465<p>
466<a href="http://www.cis.upenn.edu/%7Ebcpierce/tapl/">Types
467and Programming Languages</a>
468is an essential read; Pugs started out as a self-initiated study of the
469text,
470and it continues to be an important guide during the implementation.
471Its
472sequel, <a href="http://www.cis.upenn.edu/%7Ebcpierce/attapl/">Advanced
473Topics in
474Types and Programming Languages</a>,
475is also invaluable. It may also help to
476get acquainted with other multi-paradigmatic languages, such as <a
477 href="http://www.mozart-oz.org/">Mozart/Oz</a>,
478<a href="http://www.informatik.uni-kiel.de/%7Emh/curry/">Curry</a>
479and <a href="http://www.ocaml.org/">O&rsquo;Caml</a>.
480Finally, the detailed <a
481 href="http://www.cse.unsw.edu.au/%7Echak/haskell/ghc/comm/">GHC
482commentary</a>
483describes how GHC itself was implemented.</p>
484<h2>
485I&rsquo;d like to help. What should
486I do?</h2>
487<p>
488First, subscribe to the <a
489 href="http://nntp.perl.org/group/perl.perl6.compiler">perl6-compiler</a>
490mailing list by sending an empty mail to <a
491href="mailto:perl6-compiler-subscribe@perl.org">perl6-compiler-subscribe@perl.org</a>.
492Next, join the <a href="irc://irc.freenode.net/perl6"><code>#perl6</code>
493IRC channel</a> on <a href="http://freenode.net/">irc.freenode.net</a> to find out what needs to be done. Commit
494access is handed out liberally; contact the Pugs team on <code>#perl6</code>
495for details. See you on IRC!</p>
496</body>
497</html>
Note: See TracBrowser for help on using the browser.