• Stars
    star
    341
  • Rank 123,987 (Top 3 %)
  • Language Raku
  • License
    Other
  • Created over 13 years ago
  • Updated 19 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

NQP
=pod

=head1 NQP - Not Quite Perl

NQP is Copyright (C) 2009-2020 by The Perl Foundation.  See F<LICENSE>
for licensing details.

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

=for HTML <a href="https://dev.azure.com/Raku/nqp/_build/latest?definitionId=1&branchName=master"><img src="https://dev.azure.com/Raku/nqp/_apis/build/status/Raku.nqp?branchName=master"></a>

To build NQP from source, you'll just need a C<make> utility and C<Perl> 5.8 or
newer.  To automatically obtain and build MoarVM you may also need
a C<git> client.

To obtain C<NQP> directly from its repository:

    $ 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<NQP> can run on three different backends: C<MoarVM>, the C<JVM>, and C<JavaScript>.
The C<JVM> and C<JavaScript> backends are currently experimental.  The JVM backend
requires C<JDK 1.9> (also known as C<JDK 9>) or higher.

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 --backends=moar,jvm
    $ make

If you don't have an installed MoarVM, you can have
C<Configure.pl> download and build one for you by passing the C<--gen-moar>
option to it as well.

The C<make> step will create a C<nqp> or C<nqp.exe> executable in the current
directory.  Programs can then be run from the build directory using a
command like:

    $ ./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 directory prefix where `moar` is installed, in that case; for instance, `--with-moar=/usr/local`.

Once built, NQP's C<make install> target will install NQP and its libraries
into the same location as the MoarVM installation
that was used to create it.  Until this step is
performed, the C<nqp> executable created by C<make> above can only be
reliably run from the root of NQP's build directory.  After C<make install>
is performed the executable can be run from any directory.

If the C<NQP> compiler is invoked without an explicit script to run, it enters
a small interactive mode that allows statements to be executed from the
command line.  Each line entered is treated as a separate compilation unit,
however (which means that subroutines are preserved after they are defined,
but variables are not).

=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<NOTE:> there's B<no end-user support> for NQP and the behaviour can
change without notice. It's a tool for writing Raku compilers, not a
low-level module for Raku programmers.

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<node.js> at least 10.10.0

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<nqp-js>, you may want to pass the C<--link> option to configure to have the C<nqp-runtime> linked instead of installed

    $ cd src/vm/js/nqp-runtime; npm link .
    $ perl Configure --backends=moar,js

=cut

More Repositories

1

examples

Many examples of Raku code
Raku
296
star
2

doc

🦋 Raku documentation
Raku
287
star
3

book

Using Raku – an unfinished book about Raku
Makefile
284
star
4

roast

🦋 Raku test suite
Raku
180
star
5

ecosystem

Raku ecosystem – modules and more
Perl
139
star
6

old-design-docs

Raku language design documents
Raku
124
star
7

raku.org

Source code for https://raku.org/
HTML
70
star
8

problem-solving

🦋 Problem Solving, a repo for handling problems that require review, deliberation and possibly debate
70
star
9

raku-mode

Emacs major mode for Raku
Emacs Lisp
61
star
10

mu

Universal Raku repository (formerly called "pugs repository")
Perl
60
star
11

docker

Docker files for Rakudo Star
Dockerfile
34
star
12

advent

Contains all data relating to the annual Raku Advent event held 1-25 December
Raku
28
star
13

App-Rakubrew

Raku environment manager
Perl
26
star
14

user-experience

Identifying issues in and improving the Raku user experience
25
star
15

atom-language

Atom/Github Raku Syntax Highlighting Support 🦋
Raku
24
star
16

whateverable

🤖 Different IRC bots that operate on a bunch of prebuilt Rakudo versions
Raku
18
star
17

evalbot

IRC bot for executing Raku code
Perl
17
star
18

marketing

Marketing resources for Raku language
JavaScript
15
star
19

z

Helper script for Rakudo core development
Raku
14
star
20

CCR

The Raku Programming Language Collect, Conserve and Remaster Project
HTML
14
star
21

features

Overview of implementation status of different features in Raku compilers
HTML
13
star
22

ake

A Raku make-a-like inspired by rake
Raku
12
star
23

Documentable

Documentation API: caching, parsing, indexing and generating documentation
Raku
11
star
24

Blin

🥞 Project Blin – Toasting Reinvented
Raku
10
star
25

Raku-Steering-Council

RSC Papers
Raku
9
star
26

intellij-ide-plugin

Source dump of the former Comma IDE.
Java
8
star
27

tap-harness6

A TAP harness for Raku
Raku
8
star
28

rakubrew.org

rakubrew.org website
Raku
8
star
29

doc-website

Tooling to build/run the documentation website
CSS
7
star
30

flycheck-raku

Raku support for Flycheck
Emacs Lisp
7
star
31

setup-raku

JavaScript
7
star
32

rakudoc

A tool for reading Raku documentation
Raku
6
star
33

6.d-prep

All The Things to prepare for 6.d language release
5
star
34

ecosystem-unbitrot

Which modules are not installable?
Perl 6
5
star
35

RakudoCIBot

🤖 🦋 I am the friendly Rakudo CI bot. Bzzt! ⚡ Beep beep boop.
Raku
5
star
36

github-workflow-examples

A collection of workflow files for Raku code testing on github
5
star
37

IRC-logs

Repository of Raku IRC channel logs over the years (2005-now)
5
star
38

nqp-configure

Configuration and build modules for NQP
Perl
4
star
39

toolchain-bikeshed

(ARCHIVE) Discussion area for the Raku toolchain
4
star
40

REA

Raku Programming Language Ecosystem Archive
4
star
41

pugs-perl-modules

Perl modules from the old Pugs repository
Perl
3
star
42

museum-items

Collection repo for Raku museum items
3
star
43

flymake-rakudo

Raku(do) support for Flymake
Emacs Lisp
3
star
44

geth

GitHub Push Updates to IRC Bot
Raku
2
star
45

rakudo-star

A user-friendly distribution of the Raku programming language.
Shell
2
star
46

hacktoberfest

Centralized repository for hacktoberfest issued in the Rakuverse
2
star
47

old-issue-tracker

Tickets from RT
2
star
48

survey

Results from Raku Surveys
HTML
2
star
49

vscode-dev-container

VSCode dev container
Shell
2
star
50

please-turn-off-the-autowatch-feature

A friendly reminder that by default github will autosubscribe you to all repos of this org
2
star
51

L10N

The home of supported localizations of the Raku Programming Language
Raku
2
star
52

synopsebot

synopsebot IRC bot
Perl 6
1
star
53

RakuDoc-GAMMA

Community review of the RakuDoc standard
HTML
1
star
54

Documentable-backup

Raku documentation CLI and API
Perl 6
1
star