Pyro

A scripting language for people who enjoy the simpler things in life.

Version 0.8.50

Building & Installing Pyro


Building & Installing

You'll need a C compiler and a POSIX compatible operating system (Mac, Linux, BSD, etc.) to build Pyro from source.

First, download the Pyro repository from Github and cd into the pyro directory:

$ git clone https://github.com/dmulholl/pyro.git
$ cd pyro

To build the release binary run:

$ make release

The release binary will be created in a new out/release directory as out/release/pyro.

To install the release binary run:

$ make install

This copies the pyro binary to the /usr/local/bin/ directory. (Depending on your operating system, you may need to run sudo make install to provide the proper permissions.)

You can now run Pyro like any other installed binary:

$ pyro

Running Pyro without a script argument launches the REPL — an interactive environment where you can try running Pyro commands directly, e.g.

>>> 1 + 2;
3

Pyro statements normally end with a semicolon, ;, but you can omit the semicolon after typing a single statement in the REPL, e.g.

>>> 1 + 2
3

Hit Ctrl-D or type exit and hit return to end the REPL session.

To run a Pyro script, supply its filename to the binary:

$ pyro path/to/script.pyro

Executable Scripts

To make a Pyro script executable, add a shebang line to the top of the file, e.g.

#!/usr/bin/env pyro
echo "hello world";

Then make the script file itself executable — e.g. for a file called script.pyro:

$ chmod +x ./script.pyro

You can now run the script directly as an executable, e.g.

$ ./script.pyro
hello world

Note that the .pyro suffix is purely a convention — Pyro scripts don't require any special suffix or naming convention.

Test Suite

If you'd like to try hacking on Pyro's source code, you'll want to run the test suite after every change.

To build a new release binary and run the test suite run:

$ make check-release

To build a new debug binary and run the test suite run:

$ make check-debug

The debug binary is (much) slower than the release binary. It enables assert statements and stresses the garbage collector by running the garbage collection routine before executing each bytecode instruction.

If you'd like to try hacking on Pyro's source code, you should run the test suite with the debug binary after every change. You can do this by running the shortcut command:

$ make check

You can also run Pyro's test suite using the test command directly, e.g.

$ pyro test ./tests/*.pyro

You can learn more about the test command here.