=pod
=head1 NQP - Not Quite Perl
NQP is Copyright (C) 2009-2020 by The Perl Foundation. See F
This is "Not Quite Perl" -- a lightweight Raku-like environment for virtual machines. The key feature of NQP is that it's designed to be a very small environment (as compared with, say, raku or Rakudo) and is focused on being a high-level way to create compilers and libraries for virtual machines like L<MoarVM|https://github.com/MoarVM/MoarVM>, the JVM, and others.
Unlike a full-fledged implementation of Raku, NQP strives to have as small a runtime footprint as it can, while still providing a Raku object model and regular expression engine for the virtual machine.
=head2 Building from source
To build NQP from source, you'll just need a C
To obtain C
$ git clone git://github.com/Raku/nqp.git
If you don't have git installed, you can get a tarball or zip of NQP from github by visiting http://github.com/Raku/nqp/tree/main and clicking "Download". Then unpack the tarball or zip.
C
Once you have a copy of NQP, decide which backends you want to run, and configure and build it as follows:
$ cd nqp
$ perl Configure.pl --with-moar=/path/to/moar --backends=moar,jvm
$ make
If you don't have an installed MoarVM, you can have
C
$ cd nqp
$ perl Configure.pl --gen-moar --backends=moar,jvm
$ make
The C
$ ./nqp hello.nqp
By default, NQP searches for the MoarVM executable and installs to the
directory C<./install>. You can change that with the C<--prefix> option to
Configure.pl; this will point to the directory prefix where moar
is installed,
such as /usr
; it needs to be the same one used when configuring MoarVM unless
you use the option --with-moar
. This optional argument should point to the installed
moar
executable; for instance, --with-moar=/usr/local/bin/moar
.
Once built, NQP's C
If the C
=head2 Troubleshooting
=head3 OS X
On OS X, it appears that configuration fails in some configurations:
3rdparty/libuv/include/uv-darwin.h:26:11: fatal error: 'mach/mach.h' file not found
Should this happen to you, then a solution might be the following:
$ cd MoarVM/3rdparty/libuv/include
$ ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/mach
$ cd ../../../..
$ # run the Configure again
Note that the 10.9 in the above, represents the major version of OS X being used. On Mavericks use 10.9 (like above), on Yosemite use 10.10.
=head3 JVM
If attempting to run NQP on the JVM results in NQP claiming it couldn't reserve enough memory, you may need to increase the memory limit of your shell like so:
$ ulimit -d 6144000
=head2 Using NQP
B
The L<examples directory|https://github.com/raku/nqp/tree/main/examples> is a good place to start, with the L<loops|https://github.com/raku/nqp/blob/main/examples/loops.nqp> and other files. Opcodes are listed in L<the docs directory|https://github.com/raku/nqp/blob/main/docs/ops.markdown>. NQP also has built-in routines listed in L<the docs directory|https://github.com/raku/nqp/blob/main/docs/built-ins.md>. You can use NQP from this release, it will be already installed if you have built Raku from scratch.
=head2 JavaScript backend
The best thing before playing with it/hacking on it is to contact pmurias via IRC at C<#raku> on L<irc.libera.chat|https://web.libera.chat/?channels=#raku>.
We depend on C
Building the JavaScript backend currently requires building the moar backend:
$ perl Configure.pl --backends=moar,js
$ make
Currently it needs to be run like:
$ ./nqp-js file.nqp
If you are developing C
$ cd src/vm/js/nqp-runtime; npm link .
$ perl Configure --backends=moar,js
=cut