Perlang is a general-purpose programming language aimed at being "concurrently safe, fast and fun". Its current implementation is an interpreter implemented in C#, with some compiler-like characteristics for performing static code analysis.
The aim is to make it a fully compiled language in the long run (either to MSIL or machine code), while still remaining low-barrier and low-entry. You should never have to install a lot of packages/complex tooling to be able to start writing Perlang code; it should always remain just a single command away.
The Perlang tools are installed using
perlang-install. It works on all supported platforms
(Linux, macOS and Windows), as long as you have a POSIX compatible shell
available, e.g. bash
. Use it like this:
$ curl -sSL https://perlang.org/install | sh
The installer will refuse to overwrite an existing installation, if present. If this happens, you can force the install like this:
$ curl -sSL https://perlang.org/install | sh -s -- --force
The installer will download the latest Perlang build and unpack it in a folder
under ~/.perlang
. It will also print some instructions about how to add the
Perlang toolchain to your $PATH
.
// hello_world.per
print "Hello World";
Running this will give you the following:
$ perlang hello_world.per
Hello World
Note: this is not required for writing Perlang programs. These steps are required if you want to make changes to the Perlang code itself.
$ sudo apt-get install \
dotnet-sdk-7.0 \
make \
ruby
$ git clone https://gitlab.perlang.org/perlang/perlang.git
$ cd perlang
$ make
You should now have a perlang
executable. Run make run
to run it. If you are
brave, make install
(currently Linux only) will put binaries in a path under
~/.perlang
which you can put in your $PATH
so you can easily use it from
anywhere.
Note: this script uses the same folder (~/.perlang/nightly/bin
) as the
nightly build installer. Any previous version will be overwritten without
prompting. This means that if you have previously installed a nightly build and
added the folder to your $PATH
, the version installed with make install
will
now be available in the $PATH
instead of the previous nightly version.
Install the DocFX prerequisites, including the Mono runtime. You should then be able to run the following:
$ npm install -g live-server
$ make docs
$ make docs-serve
When you make changes to the documentation, run make docs
to regenerate them.
The live-server
process which is started by make docs-serve
will
conveniently make your browser auto-reload the changes.
If you want to continuously rebuild documentation, run make docs-autobuild
in
a separate terminal window. This does not currently work flawlessly, so the
make docs
approach is preferable.
Each commit to the master
branch triggers a build that gets published as a set
of .tar.gz
files at https://builds.perlang.org (CDN sponsored by
Fastly). Binaries are available for Linux, macOS and
Windows. These builds can be installed using the
perlang-install script mentioned earlier in this
guide.
perlang-install is originally based on rustup-init, which is also licensed under the MIT license. Copyright (c) 2016 The Rust Project Developers.
src/Perlang.Stdlib/Stdlib/Posix.cs includes content from the NetBSD project, licensed under the 3-clause BSD license. Copyright (c) 1980, 1991, 1993 The Regents of the University of California. All rights reserved.
src/stdlib/src/bigint.hpp includes content from
Syed Faheel Ahmad's BigInt
library, available at
https://github.com/faheel/BigInt, licensed under the terms of the MIT license.
Copyright (c) 2017 - 2018 Syed Faheel Ahmad.
src/stdlib/src/libtommath includes content from libtommath (https://github.com/libtom/libtommath), licensed under the Unlicense (http://unlicense.org).
src/stdlib/src/double-conversion includes
content from the Google double-conversion
library, available at
https://github.com/google/double-conversion, licensed under the BSD 3-Clause
"New" or "Revised" License. Copyright 2006-2011, the V8 project authors.
src/stdlib/src/fmt includes content from the {fmt}
library, available at https://github.com/fmtlib/fmt, licensed under the MIT
license. Copyright (c) 2012 - present, Victor Zverovich and {fmt}
contributors.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.