1parrot-nqp(1) User Contributed Perl Documentation parrot-nqp(1)
2
3
4
6 NQP is Copyright (C) 2009 by Patrick R. Michaud. See LICENSE for
7 licensing details.
8
9 This is "Not Quite Perl" -- a compiler for quickly generating PIR
10 routines from Perl6-like code. The key feature of NQP is that it's
11 designed to be a very small compiler (as compared with, say, perl6 or
12 Rakudo) and is focused on being a high-level way to create transformers
13 for Parrot (especially hll compilers). In addition, unlike Rakudo, NQP
14 attempts to restrict itself to generating code that can run in Parrot
15 without the existence of any NQP-specific runtime libraries.
16
17 Building from source
18 NQP comes bundled with Parrot, so if you have a recent Parrot
19 distribution you likely also have a copy of NQP. Inside of a Parrot
20 installation NQP is known as "parrot-nqp".
21
22 To build NQP from source, you'll just need a "make" utility and Perl
23 5.8 or newer. To automatically obtain and build Parrot you may also
24 need a Git client.
25
26 To obtain NQP directly from its repository:
27
28 $ git clone git://github.com/perl6/nqp-rx.git
29
30 If you don't have git installed, you can get a tarball or zip of NQP
31 from github by visiting http://github.com/perl6/nqp-rx/tree/master and
32 clicking "Download". Then unpack the tarball or zip.
33
34 Once you have a copy of NQP, build it as follows:
35
36 $ cd nqp-rx
37 $ perl Configure.pl --gen-parrot
38 $ make
39
40 This will create a "nqp" or "nqp.exe" executable in the current (nqp-
41 rx) directory. Programs can then be run from the build directory using
42 a command like:
43
44 $ ./nqp hello.pl
45
46 The "--gen-parrot" option above tells Configure.pl to automatically
47 download and build the most appropriate version of Parrot into a local
48 "parrot/" subdirectory, install that Parrot into the "parrot_install/"
49 subdirectory, and use that for building NQP. It's okay to use the
50 "--gen-parrot" option on later invocations of Configure.pl; the
51 configure system will re-build Parrot only if a newer version is needed
52 for whatever version of Rakudo you're working with.
53
54 You can use "--parrot-config=/path/to/parrot_config" instead of
55 "--gen-parrot" to use an already installed Parrot for building NQP.
56 This installed Parrot must include its development environment;
57 typically this is done via Parrot's "make install" target or by
58 installing prebuilt "parrot-devel" and/or "libparrot-dev" packages.
59 The version of the already installed Parrot must satisfy a minimum
60 specified by the NQP being built -- Configure.pl will verify this for
61 you. Released versions of NQP always build against the latest release
62 of Parrot; checkouts of the HEAD revision from github often require a
63 version of Parrot that is newer than the most recent Parrot monthly
64 release.
65
66 Once built, NQP's "make install" target will install NQP and its
67 libraries into the Parrot installation that was used to create it.
68 Until this step is performed, the "nqp" executable created by "make"
69 above can only be reliably run from the root of NQP's build directory.
70 After "make install" is performed the executable can be run from any
71 directory (as long as the Parrot installation that was used to create
72 it remains intact).
73
74 If the NQP compiler is invoked without an explicit script to run, it
75 enters a small interactive mode that allows statements to be executed
76 from the command line. Each line entered is treated as a separate
77 compilation unit, however (which means that subroutines are preserved
78 after they are defined, but variables are not).
79
80 Differences from previous version of NQP
81 * Sub declarations are now lexical ("my") by default, use
82 "our sub xyz() { ... }" if you want package-scoped subroutines.
83
84 * The PIR q<...>; construct is gone. Use Q:PIR or pir::opcode(...)
85 instead.
86
87 * The mainline code of modules is no longer tagged as ":load :init"
88 by default. Use INIT { ... } for any code that you want to be
89 run automatically at startup.
90
91 * Cuddled else's are no longer valid Perl 6, 'else' requires a
92 space after it.
93
94 * Double-quoted strings now interpolate $-variables.
95
96
97
98perl v5.12.3 2011-07-18 parrot-nqp(1)