root/docs/01Overview.kwid

Revision 16694, 15.7 kB (checked in by Darren_Duncan, 19 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/plain; charset=UTF-8
  • Property svn:eol-style set to native
Line 
1= Pugs Apocryphon 1 -- Overview of the Pugs project
2
3== What is this document about?
4
5The [Pugs Apocrypha|http://svn.perl.org/perl6/pugs/trunk/docs/] are a series of
6 documents, written in question/answer format, to explain the design and
7 implementation of Pugs.  This document (PA01) is a higher-level overview of the
8 project.
9
10== What is Pugs?
11
12Started in February 2005, [Pugs|http://pugscode.org/] is an
13implementation of the Perl 6 language. [Autrijus
14Tang|http://use.perl.org/%7Eautrijus/journal/] is responsible for the
15design and development of Pugs with help from a group of committers and
16contributors.
17
18== What is Perl 6?
19
20[Perl 6|http://dev.perl.org/perl6/] is the next major revision of Perl,
21a context-sensitive, multi-paradigmatic, /practical/ programming
22language, designed by a team led by Larry Wall. The Pugs project was
23[enthusiastically
24welcomed|http://www.nntp.perl.org/group/perl.perl6.language/19263] by the Perl 6
25team.
26
27== Is Pugs the official Perl 6?
28
29Official Perl 6 is now defined as any implementation which passes the
30Perl 6 testsuite.  So Pugs is expected to be an official Perl 6, but
31not necessarily the only one.
32
33== Has Perl 6 been specified?
34
35By December 2004, most of Perl 6 had been specified as a series of
36[Synopses|http://dev.perl.org/perl6/synopsis/]. Although not considered
37final, it is now stable enough to be implemented. Many of the Synopses
38are based on Larry's [Apocalypses|http://dev.perl.org/perl6/apocalypse/].
39Sometimes the design team releases
40[Exegeses|http://dev.perl.org/perl6/exegesis/], which explain the Apocalypses.
41Pugs adheres to the Synopses, referring to the Apocalypses or Exegeses when a
42 Synopsis is unclear or imprecise.
43
44== What does "Apocrypha" mean?
45
46The word [Apocrypha|http://en.wikipedia.org/wiki/Apocrypha], from the
47Greek word απκρυφος or "hidden",
48refers to religious works that are not considered canonical, or part of
49officially accepted scripture. The proper singular form in Greek is
50"Apocryphon".
51
52== What is the relationship between the Apocrypha and the Perl 6 design
53documents?
54
55Apocalypses and Synopses cover the Perl 6 language in general; Apocrypha
56are specific to the Pugs implementation. Like the [Parrot Design
57Documents|http://www.parrotcode.org/docs/pdd/], the Apocrypha will be
58constantly updated according to the status of Pugs.
59
60== Will Pugs implement the full Perl 6 specification?
61
62Yes. Pugs always targets the latest revision of Perl 6 Synopses. As soon
63as a new revision or a new Synopsis is published, incompatibilities
64between Pugs and the new version will be considered bugs in Pugs.
65
66== Is Pugs free software?
67
68Yes. It is available under the
69[Artistic License version 2.0|http://svn.pugscode.org/pugs/LICENSE/Artistic-2].
70
71== Is Pugs funded by the Perl Foundation?
72
73No. After receiving three [Perl Foundation
74grants|http://www.perlfoundation.org/gc/grants/2003_autrijus.html] on
75various projects, Autrijus decides it would be more helpful to donate
76time to the Perl 6 project by hacking Pugs, rather than asking TPF for
77money to do the same thing.
78
79== Where can I download Pugs?
80
81For the very latest version of Pugs, check out the source from the
82[Subversion|http://svn.pugscode.org/pugs/] or
83[darcs|http://wagner.elixus.org/~autrijus/darcs/pugs] repositories. Periodic
84releases are available on CPAN under the
85`[Perl6-Pugs|http://search.cpan.org/dist/Perl6-Pugs/]` distribution.
86(By the way, if you'd like to work offline with the Subversion
87repository, [the `svk` client|http://svk.elixus.org/] may be of interest.
88Using vanilla `svn` is fine, though.)
89
90== How do I build Pugs?
91
92Pugs uses the standard Makefile.PL build system, as detailed in the
93`[README|http://svn.pugscode.org/pugs/README]` file. Since Pugs is
94written in Haskell, you will need [the Glasgow Haskell
95Compiler (GHC)|http://haskell.org/ghc/] 6.4 or above. Please [download a
96binary build|http://haskell.org/ghc/download_ghc_64.html] for your platform;
97compiling GHC from source is a long, tedious process.
98
99== What is Haskell?
100
101[Haskell|http://haskell.org/] is a standardized, purely functional programming
102language with builtin [lazy
103 evaluation|http://en.wikipedia.org/wiki/Lazy_evaluation] capabilities. While
104 there are several different implementations available, Pugs currently needs to
105 be built with GHC, as it uses several GHC-specific features.
106
107== What is GHC?
108
109GHC is a state-of-the-art compiler and interactive environment, available under
110[a BSD-style license|http://haskell.org/ghc/license.html]. Written in Haskell
111itself, GHC can compile Haskell to bytecode, C code, and machine code (on some
112platforms). GHC has an extensive library, numerous language extensions, and a
113very capable optimizer (with some help from [a Perl 5
114program|http://www.cse.unsw.edu.au/%7Echak/haskell/ghc/comm/the-beast/mangler.html]).
115As such, it provides an excellent platform to solve Perl 6's /bootstrapping
116problem/.
117
118== What is the Perl 6 bootstrapping problem?
119
120The goal of the Perl 6 project is to be /self-hosting/: the Perl 6
121compiler needs to be written in Perl 6 itself, and must parse Perl 6
122source code with Perl 6 Rules, the next-generation pattern matching syntax for
123Perl 6.  The generated code must also contain an evaluator that can execute Perl
1246 code on the fly. The only way to break this cycle of dependency is by
125first implementing some parts in other languages, then rewriting those
126parts in Perl 6.
127
128== What was the initial bootstrapping plan?
129
130According to the
131[Parrot FAQ|http://search.cpan.org/dist/parrot/docs/faq.pod#Isn't_there_a_bootstrapping_problem?],
132the initial plan was to bootstrap via Perl 5: first extend Perl 5 to run on the
133Parrot virtual machine (via `B::Parrot` or [Ponie|http://www.poniecode.org/]),
134then implement the Perl 6 compiler in Perl 5, which will be translated to Perl 6
135via a p5-to-p6 translator. However, although part of the Rules system was
136prototyped in Perl 5 as
137`[Perl6::Rules|http://search.cpan.org/dist/Perl6-Rules/]`, it was not mature
138enough to build a compiler on. As such, the plan was revised to bootstrap via C
139instead.
140
141== What is the revised bootstrapping plan?
142
143According to an early 2005
144[proposal|http://www.perlfoundation.org/gc/grants/2005-p6-proposal.html], the
145plan is to first implement the Rule engine in C (i.e. [the Perl Grammar Engine
146(PGE)|http://cvs.perl.org/viewcvs/cvs-public/parrot/compilers/pge/]), use it to
147parse Perl 6 into Parrot as an [abstract syntax
148tree|http://en.wikipedia.org/wiki/Abstract_syntax_tree] (AST), and then
149implement an AST evaluator as part of Parrot. Ponie and p5-to-p6 are still being
150worked on, but they are no longer critical dependencies in the bootstrapping
151process.
152
153== How can Pugs help Perl 6 to bootstrap?
154
155In a bootstrapping process, there are often many bottlenecks, which prevent
156people from working on things that depend on them. For example, one cannot
157easily write unit tests and standard libraries for Perl 6 without a working
158Perl 6 implementation, or work on an AST evaluator without an AST interface.
159Pugs solves such deadlocks by providing ready substitutes at various levels of
160the process.
161
162== How can Pugs help the Perl 6 language design?
163
164Without a working implementation, it is very hard to spot
165inconsistencies and corner cases in the specification. However, if a
166design problem is found late in the implementation phase, it may require the
167costly rearchitecture of everything else. By providing a working Perl 6
168implementation, Pugs can serve as a proving ground, finding and resolving
169problems as early as possible, as well as encourage more people to exercise Perl
1706's features.
171
172== Why did you choose Haskell?
173
174Many Perl 6 features have very similar Haskell counterparts: Perl 6 Rules
175correspond closely to
176[Parsec|http://www.cs.uu.nl/%7Edaan/download/parsec/parsec.html]; lazy
177list evaluation is common in both languages; continuation support can be
178modeled with the [ContT|http://www.nomaware.com/monads/html/contmonad.html]
179monad transformer; and so on. This greatly simplified the prototyping
180effort: the first working interpreter was released [within the first
181week|http://use.perl.org/~autrijus/journal/23051], and by the [third
182week|http://use.perl.org/~autrijus/journal/23335] a fully-fledged
183`[Test.pm|http://svn.pugscode.org/pugs/lib/Perl6/lib/Test.pm]`
184module was available for unit testing.
185
186== What is the relationship between Pugs and Parrot?
187
188The plan is for Pugs to target Parrot PIR. This is
189already possible; Pugs can target Parrot PIR using an experimental Parrot
190backend, which is being improved steadily.
191
192== Is Pugs a compiler or an interpreter?
193
194Similar to Perl 5, Pugs first compiles Perl 6 program to an AST, then
195executes it using the built-in evaluator. However, in the future Pugs
196may also provide a compiler interface that supports different compiler
197backends.
198
199== Which compiler backends are available?  Will more be added?
200
201Currently, there are three compiler backends available: Pugs, Parrot
202(experimental) and Haskell. More backends may be added if people can work on
203them (e.g. Perl 5 bytecode).
204
205== Do you have a roadmap for Pugs development?
206
207The major/minor version numbers of Pugs converge to 2*π; each
208significant digit in the minor version represents a milestone. The
209third digit is incremented for each release. The current milestones
210are:
211
212* 6.0: Initial release.
213* 6.2: Basic IO and control flow elements; mutable variables; assignment.
214* 6.28: Classes and traits.
215* 6.283: Rules and Grammars.
216* 6.2831: Type system and linking.
217* 6.28318: Macros.
218* 6.283185: Port Pugs to Perl 6, if needed.
219
220== How portable is Pugs?
221
222Pugs runs on Win32, Linux and many flavors of Unix systems. See GHC's
223[porters list|http://haskell.org/ghc/contributors.html] and [download
224page|http://haskell.org/ghc/download_ghc_622.html] for details.
225Binaries for Windows 2000/XP are available as part of [the PXPerl
226distribution|http://pixigreg.com/?pxperl].  There are plans to provide binaries
227for other platforms as well eventually.
228
229== How fast is Pugs?
230
231The parser part of Pugs is very fast, due to its robust underpinning in
232Parsec. However, the Pugs evaluator is currently not optimized at all:
233dispatching is around 1000 operators per second on a typical PC, which
234is nearly 100 times slower than Perl 5. Still, it is fast enough for
235prototyping language features; if you need fast operations in Pugs,
236please consider helping out by working on the Compiler backend.
237
238== Is there a CPAN for Perl 6 modules?
239
240No. The current preferred method for submitting Perl 6/Pugs modules is
241to ask for a committer bit at commitbit.pugscode.org and add your module to
242the Pugs source tree under the modules/ directory. It is also helpful to
243include test suites with your modules as well, so we can know when they
244work.
245
246However, all is not lost. If you are patient you can wait for
247`Pugs::MakeMaker` and `Module::Install::Pugs` to come out on CPAN. Once
248they are available individually on CPAN, you can begin submitting things
249to CPAN, because that means we've figured out the distribution problem.
250Of course, suggestions are always welcome.
251
252== Can Pugs work with Perl 5 libraries?
253
254Yes, Pugs can work with Perl 5 libraries. This requires that Pugs be compiled
255with Perl 5 embedding. Pugs understands Perl 5 objects, classes and functions.
256Pugs objects, classes and functions are also understood by Perl 5.
257As such, these types can be used in round-trip callbacks.
258
259Examples of working with Perl 5 may be found in [the source
260tree|http://svn.pugscode.org/pugs/t/unspecced/p5/].
261
262== Can Pugs work with Haskell libraries?
263
264Yes. Pugs can be compiled with
265`[hs-plugins|http://www.cse.unsw.edu.au/%7Edons/hs-plugins/]` support, which
266allows it to use Haskell libraries. It is also capable of dynamically loading
267Haskell modules. Aside from this, inline Haskell can be evaluated using
268`eval('...', :lang<haskell>)`.
269
270In addition, at the basic level, you can statically link Haskell libraries into
271Pugs primitives, by modifying a few lines in `Prim.hs`.
272
273== Can Pugs work with C libraries?
274
275Not yet. However, [HaskellDirect|http://www.haskell.org/hdirect/] seems to
276provide an easy way to interface with C, CORBA and COM libraries, especially
277when combined with `hs-plugins` (described above).
278
279== I know Perl 5, but not Haskell. Can I help develop Pugs?
280
281Sure! The standard libraries and unit tests that come with Pugs are
282coded in Perl 6, and there is always a need for more tests and
283libraries. All you need is basic familiarity with Perl 5, and a few
284minutes to acquaint yourself with some small syntax changes. A ["Porting
285HOWTO"|http://svn.pugscode.org/pugs/docs/other/porting_howto] is also
286available, which should help ease the transition. You'll
287likely pick up some Haskell knowledge along the way, too.
288
289== I know Haskell, but not Perl 5. Can I help develop Pugs?
290
291Sure! Perl 6 and Haskell have many things in common, such as type-based
292function dispatch, first-class functions, and currying, so picking up the
293syntax is relatively easy. Since there are always some TODO tests for
294features in need of implementation, it is never hard to find something
295to do.
296
297== I have learned some Perl 6. What can I do with Pugs?
298
299Look at the `examples/` directory to see some sample programs. Some people
300are already writing web applications and report systems with Pugs. If
301you run into a missing feature in Pugs, you are encouraged to write TODO tests
302for it (if there aren't any already) so that someone can implement it.
303
304== Where can I learn more about Haskell?
305
306[The Haskell homepage|http://www.haskell.org/] and
307[the Wiki|http://haskell.org/hawiki/] are good entry points. Of the
308many online tutorials, [Yet Another Haskell
309Tutorial|http://www.isi.edu/%7Ehdaume/htut/] is perhaps the most accessible.
310Due to the ubiquitous use of Monad transformers in Pugs, [All About
311Monads|http://www.nomaware.com/monads/html/] is also recommended. For books,
312[Algorithms: A Functional Programming
313Approach|http://www.iro.umontreal.ca/%7Elapalme/Algorithms-functional.html],
314[Haskell: The Craft of Functional Programming|http://www.cs.kent.ac.uk/people/staff/sjt/craft2e/]
315and [The Haskell School of Expression|http://haskell.org/soe/] are fine
316introductory materials. Finally,
317[the `#haskell` channel|irc://irc.freenode.net/haskell] on
318[freenode|http://freenode.net] is always full of helpful and interesting people.
319
320== Where can I learn more about Perl 6?
321
322[The Perl 6 homepage|http://dev.perl.org/perl6/] provides
323many online documents. Every week or two, a new Perl 6 list summary appears on
324[Perl.com|http://www.perl.com/]; it is a must-read for people who wish to
325follow Perl 6's progress. For books, [Perl 6 and Parrot
326Essentials|http://www.oreilly.com/catalog/059600737X/] and [Perl 6
327Now|http://www.apress.com/book/bookDisplay.html?bID=355] are both helpful.
328
329== Where can I learn more about implementing programming languages?
330
331[Types and Programming Languages|http://www.cis.upenn.edu/%7Ebcpierce/tapl/] is
332an essential read; Pugs started out as a self-initiated study of the text, and
333it continues to be an important guide during the implementation. Its sequel,
334[Advanced Topics in Types and Programming
335Languages|http://www.cis.upenn.edu/%7Ebcpierce/attapl/], is also invaluable. It
336may also help to get acquainted with other multi-paradigmatic languages, such as
337 [Mozart/Oz|http://www.mozart-oz.org/],
338[Curry|http://www.informatik.unikiel.de/%7Emh/curry/] and
339[O'Caml|http://www.ocaml.org/]. Finally, the detailed [GHC
340commentary|http://www.cse.unsw.edu.au/%7Echak/haskell/ghc/comm/] describes how
341GHC itself was implemented.
342
343== I'd like to help. What should I do?
344
345First, subscribe to the
346[perl6-compiler|http://nntp.perl.org/group/perl.perl6.compiler]
347mailing list by sending an empty mail to
348[perl6-compiler-subscribe@perl.org|mailto:perl6-compiler-subscribe@perl.org].
349Next, join [the `#perl6` IRC channel|irc://irc.freenode.net/perl6] on
350[freenode|http://freenode.net/] to find out what needs to be done.
351Commit access is handed out liberally; contact the Pugs team on `#perl6` for
352details. See you on IRC!
Note: See TracBrowser for help on using the browser.