ponylang/ponyc
Pony Compiler - http://www.ponylang.io/
100K+
This project exists thanks to all the people who contribute. [Contribute].
Thank you to all our backers! 🙏 [Become a backer]
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
Need help? Not to worry, we have you covered.
We have a couple resources designed to help you learn, we suggest starting with the tutorial and from there, moving on to the Pony Patterns book. Additionally, standard library documentation is available online.
If you are looking for an answer "right now", we suggest you give our Zulip community a try. Whatever your question is, it isn't dumb, and we won't get annoyed.
Think you've found a bug? Check your understanding first by writing the mailing list. Once you know it's a bug, open an issue.
If you want a quick way to test or run code, checkout the Playground.
lang#pony
layer inside configuration file ($HOME/.SpaceVim.d/init.toml)Pony supports LLVM 3.9 and on an experimental basis it supports LLVM 4.0 and 5.0.
Pony's prerequisites for CPU platforms are:
arm
and armhf
architectures are tested via CI (Continuous
Integration testing)Want to use the latest revision of Pony source, but don't want to build from source yourself? You can run the ponylang/ponyc
Docker container, which is created from an automated build at each commit to master.
You'll need to install Docker using the instructions here. Then you can pull the latest ponylang/ponyc
image using this command:
docker pull ponylang/ponyc:latest
Then you'll be able to run ponyc
to compile a Pony program in a given directory, running a command like this:
docker run -v /path/to/my-code:/src/main ponylang/ponyc
If you're unfamiliar with Docker, remember to ensure that whatever path you provide for /path/to/my-code
is a full path name and not a relative path, and also note the lack of a closing slash, /
, at the end of the path name.
Note that if your host doesn't match the docker container, you'll probably have to run the resulting program inside the docker container as well, using a command like this:
docker run -v /path/to/my-code:/src/main ponylang/ponyc ./main
If you're using docker-machine
instead of native docker, make sure you aren't using an incompatible version of Virtualbox.
Pull the latest image as above.
docker pull ponylang/ponyc:latest
Share a local drive (volume), such as c:
, with Docker for Windows, so that they are available to your containers. (Refer to shared drives in the Docker for Windows documentation for details.)
Then you'll be able to run ponyc
to compile a Pony program in a given directory, running a command like this:
docker run -v c:/path/to/my-code:/src/main ponylang/ponyc
Note the inserted drive letter. Replace with your drive letter as appropriate.
To run a program, run a command like this:
docker run -v c:/path/to/my-code:/src/main ponylang/ponyc ./main
To compile and run in one step run a command like this:
docker run -v c:/path/to/my-code:/src/main ponylang/ponyc sh -c "ponyc && ./main"
By default, the Pony Docker image is compiled without support for AVX CPU instructions. For optimal performance on modern hardware, you should build your Pony installation from source.
For Red Hat, CentOS, Oracle Linux, Fedora Linux, or openSUSE, the release
builds are packaged and available on COPR (ponylang/ponylang).
yum
for Red Hat, CentOS, Oracle Linux and other RHEL compatible systems:yum copr enable ponylang/ponylang epel-7
yum install ponyc
See https://bugzilla.redhat.com/show_bug.cgi?id=1581675 for why epel-7
is required on the command line.
DNF
for Fedora Linux:dnf copr enable ponylang/ponylang
dnf install ponyc
zypper addrepo --refresh --repo https://copr.fedorainfracloud.org/coprs/ponylang/ponylang/repo/opensuse-leap-15.0/ponylang-ponylang-opensuse-leap-15.0.repo
wget https://copr-be.cloud.fedoraproject.org/results/ponylang/ponylang/pubkey.gpg
rpm --import pubkey.gpg
zypper install ponyc
By default, the Pony RPM package is compiled without support for AVX CPU instructions. For optimal performance, you should build your Pony installation from source.
For Ubuntu and Debian Linux, the release
builds are packaged and available on Bintray (pony-language/ponylang-debian).
Install packages to allow apt
to use a repository over HTTPS:
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
Install builds via Apt (and install Ponylang's public key):
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E04F0923 B3B48BDA
sudo add-apt-repository "deb https://dl.bintray.com/pony-language/ponylang-debian $(lsb_release -cs) main"
sudo apt-get update
sudo apt-get -V install ponyc
By default, the Pony DEB package is compiled without support for AVX CPU instructions. For optimal performance, you should build your Pony installation from source.
All steps to install Pony in Linux Mint are the same from Ubuntu, but you must use the Ubuntu package base (xenial
, bionic
) instead of the Linux Mint release.
Install pre-requisites and add the correct apt
repository:
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E04F0923 B3B48BDA
source /etc/upstream-release/lsb-release
sudo add-apt-repository "deb https://dl.bintray.com/pony-language/ponylang-debian $DISTRIB_CODENAME main"
sudo apt-get update
sudo apt-get -V install ponyc
The same AVX2 support restrictions apply.
layman -a stefantalpalaru
emerge dev-lang/pony
A live ebuild is also available in the overlay (dev-lang/pony-9999) and for Vim users there's app-vim/pony-syntax.
brew update
brew install ponyc
nix-env -i ponyc
If you get an error when trying to use ponyc
to compile pony source
that looks like this:
collect2: fatal error: cannot find 'ld'
you might have to install the ld-gold
linker. It can typically be
found by searching your distro's package repository for binutils-gold
or just ld-gold
.
brew update
brew install ponyc
Windows users will need to install:
Windows 10 SDK (10.x.x.x) for Desktop
will be installed.Once you have installed the prerequisites, you can download the latest ponyc release from bintray.
First of all, you need a compiler with decent C11 support. The following compilers are supported, though we recommend to use the most recent versions.
When building ponyc from sources the LLVM installed on your system is used by default. Optionally, you may also build ponyc with LLVM from sources.
To compile Pony using LLVM sources on Linux add -f Makefile-lib-llvm
to any of the examples below. For instance on Ubuntu the standard command line is simply make
, to build ponyc using LLVM from sources the command line is make -f Makefile-lib-llvm
. Alternatively you can create a symlink from Makefile to Makefile-lib-llvm, ln -sf Makefile-lib-llvm Makefile
, and no changes would be needed to the commands. You can specify llvm_target=llvm-6.0.0
on the command line and those sources will be used. For example make -f Makefile-lib-llvm llvm_target=llvm-6.0.0
.
Typically you only need to build the LLVM sources once, as the make clean
target does not cause the LLVM sources to be rebuilt. To rebuild everything use make -f Makefile-lib-llvm clean-all && make -f Makefile-lib-llvm
. There is also a distclean target, make -f Makefle-lib-llvm distclean
, which will remove the llvm sources and they will be retrieved from the ponylang/llvm repo.
NOTE: If LLVM version < 5.0.0 is used, cpu feature avx512f
is disabled automagically to avoid LLVM bug 30542 otherwise the compiler crashes during the optimization phase.
Changing the commit associated with LLVM_CFG=llvm-default.cfg
When LLVM_CFG is not specified or it is llvm-default.cfg the commit associated with the src
submodule is checked out as the llvm source to be built. To change to a different commit, for instance tag llvmorg-8.0.0
, simply clone ponyc and change lib/llvm/src
to the desired commit:
git clone --recurse-submodules https://github.com/<you>/ponyc
cd ponyc
git checkout -b update-lib-llvm-src-to-llvmorg-8.0.0
cd lib/llvm/src
git checkout llvmorg-8.0.0
cd ../../../
If you already have ponyc checked out update/init lib/llvm/src
submodule, if it hasn't been fetched, and then go into lib/llvm/src
and checkout the desired commit:
git submodule update --init
cd lib/llvm/src
git checkout llvmorg-8.0.0
cd ../../../
Debug/test ....
Now build and test using LLVM_CFG=llvm-default.cfg
and any other appropriate parameters:
make -j12 LLVM_CFG=llvm-default.cfg default_pic=true -f Makefile-lib-llvm
When satisfied create a commit pushing to your repo:
git add lib/llvm/src
git commit -m "Update submodule lib/llvm/src to llvmorg-8.0.0"
git push origin update-lib-llvm-src-to-llvmorg-8.0.0
See the Submodule section of the git-scm book for more information.
Get the pony source from GitHub (For information on setting up Git, see https://help.github.com/articles/set-up-git/):
sudo apt install git
git clone git://github.com/ponylang/ponyc
Install pony dependencies:
pacman -S llvm make ncurses zlib
To build ponyc and compile and run helloworld:
cd ~/ponyc/
make default_pic=true
./build/release/ponyc examples/helloworld
./helloworld
Install pony dependencies:
sudo apt-get update
sudo apt-get install make gcc g++ git zlib1g-dev libncurses5-dev \
llvm llvm-dev
To build ponyc, compile and run helloworld:
cd ~/ponyc/
make default_pic=true
./build/release/ponyc examples/helloworld
./helloworld
Add the LLVM apt repos to /etc/apt/sources.list. Open /etc/apt/sources.list
and add the following lines to the end of the file:
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main
Add the LLVM repo as a trusted source:
cd /tmp
wget -O llvm-snapshot.gpg.key http://apt.llvm.org/llvm-snapshot.gpg.key
sudo apt-key add llvm-snapshot.gpg.key
sudo apt-get update
sudo apt-get install -y build-essential git zlib1g-dev libncurses5-dev llvm-3.9
Clone the ponyc repo:
cd ~/
git clone https://github.com/ponylang/ponyc.git
Build ponyc, compile and run helloworld:
cd ~/ponyc/
make
./build/release/ponyc examples/helloworld
./helloworld
sudo apt-get update
sudo apt-get install -y build-essential git zlib1g-dev libncurses5-dev llvm-3.9
Clone the ponyc repo:
cd ~/
git clone https://github.com/ponylang/ponyc.git
Build ponyc, compile and run helloworld:
cd ~/ponyc/
make default_pic=true
./build/release/ponyc examples/helloworld
./helloworld
Instructions for Linux Mint are the same as the appropriate Ubuntu installation. However, an extra llvm-3.9-dev
package is required for missing headers.
After installing the llvm
package by following the appropriate steps for Ubuntu Trusty (Linux Mint 17), Xenial (Linux Mint 18), or Bionic (Linux Mint 19), install the extra headers:
sudo apt-get install -y llvm-3.9-dev
dnf check-update
sudo dnf install git gcc-c++ make zlib-devel llvm-devel ncurses-devel
To build ponyc, compile and run helloworld:
cd ~/ponyc/
make
./build/release/ponyc examples/helloworld
./helloworld
dnf check-update
sudo dnf install git gcc-c++ make zlib-devel llvm3.9-devel ncurses-devel \
libatomic
To build ponyc, compile and run helloworld:
cd ~/ponyc/
make
./build/release/ponyc examples/helloworld
./helloworld
Install dependencies:
sudo yum install git gcc-c++ make zlib-devel ncurses-devel libatomic
Using LLVM 3.9.1 from EPEL:
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install ./epel-release-latest-7.noarch.rpm
sudo yum install llvm3.9-devel llvm3.9-static
Using LLVM 3.9.1 from copr:
sudo yum install yum-plugin-copr
sudo yum copr enable alonid/llvm-3.9.1
sudo yum install llvm-3.9.1 llvm-3.9.1-devel llvm-3.9.1-static
Using LLVM 5.0.1 from copr:
sudo yum install yum-plugin-copr
sudo yum copr enable alonid/llvm-5.0.1
sudo yum install llvm-5.0.1 llvm-5.0.1-devel llvm-5.0.1-static
Using LLVM 4.0.1 from llvm-toolset-7 from SCL:
CentOS:
# 1. Install a package with repository for your system:
# On CentOS, install package centos-release-scl available in CentOS repository:
sudo yum install centos-release-scl
RHEL:
# On RHEL, enable RHSCL repository for you system:
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
# 2. Install the collection:
sudo yum install llvm-toolset-7 llvm-toolset-7-llvm-devel llvm-toolset-7-llvm-static
Enable the llvm collection before building:
scl enable llvm-toolset-7 bash
To build ponyc, compile and run helloworld:
cd ~/ponyc/
make
./build/release/ponyc examples/helloworld
./helloworld
sudo zypper addrepo http://download.opensuse.org/repositories/devel:tools:compiler/openSUSE_Leap_42.3/devel:tools:compiler.repo
sudo zypper refresh
sudo zypper update
sudo zypper install git gcc-c++ make zlib-devel \
llvm3_9-devel binutils-gold
To build ponyc, compile and run helloworld:
cd ~/ponyc/
make
./build/release/ponyc examples/helloworld
./helloworld
NOTE: LLVM 3.9 doesn't seem to be available so these instructions install the default LLVM version available.
sudo zypper install git gcc-c++ make zlib-devel \
llvm-devel binutils-gold
To build ponyc, compile and run helloworld:
cd ~/ponyc/
make
./build/release/ponyc examples/helloworld
./helloworld
Install build tools/dependencies:
apk add --update alpine-sdk binutils-gold llvm3.9-static llvm3.9-dev \
libexecinfo-dev coreutils linux-headers zlib-dev ncurses-dev
To build ponyc, compile and run helloworld:
cd ~/ponyc/
make default_pic=true
./build/release/ponyc examples/helloworld
./helloworld
You need to have the development versions of the following installed:
There is experimental support for LLVM 4.0.1 and 5.0.0, but this may result in decreased performance or crashes in generated applications.
To build ponyc, compile and run the hello world app:
cd ~/ponyc/
make
./build/release/ponyc examples/helloworld
./helloworld
Pony previously worked on DragonFly, however, at this time, while it builds, it doesn't pass all tests. If you'd be interested in getting Pony working on DragonFly, have at it. You'll need the following dependencies:
First, install the required dependencies:
sudo pkg install gmake
sudo pkg install llvm60
First, install the required dependencies:
sudo pkg install gmake
sudo pkg install llvm70
sudo pkg install libunwind
This will build ponyc and compile helloworld:
gmake
./build/release/ponyc examples/helloworld
OpenBSD has been tested on OpenBSD 6.5.
First, install the required dependencies:
doas pkg_add gmake libexecinfo llvm
This will build ponyc and compile helloworld:
gmake verbose=true bits=64
./build/release/ponyc examples/helloworld
If you are on a 32-bit platform (e.g., armv7), change bits=64
to bits=32
.
You'll need llvm 3.9.1 to build Pony. You can use either homebrew or MacPorts to install your dependencies.
There is experimental support for LLVM 4.0.1 or 5.0.0, but this may result in decreased performance or crashes in generated applications.
Installation via homebrew:
brew update
brew install llvm@3.9
Installation via MacPorts:
sudo port install llvm-3.9
sudo port select --set llvm mp-llvm-3.9
Launch the build with make
after installing the dependencies:
make
./build/release/ponyc examples/helloworld
Building on Windows requires the following:
Windows 10 SDK (10.x.x.x) for Desktop
will be installed.In a command prompt in the ponyc
source directory, run the following:
make.bat configure
(You only need to run make.bat configure
the first time you build the project.)
make.bat build test
This will automatically perform the following steps:
build/<config>-<llvm-version>
directory.docker pull ponylang/ponyc