git.iko.soy/rowtype-yoga/purescript-native
on 91649ec help sign in

A native compiler backend for PureScript (via C++ or Golang)

git clone https://git.iko.soy/rowtype-yoga/purescript-native.git

PureScript

This is an experimental C++11 (or later) compiler backend for PureScript. It attempts to generate "sane", debuggable, and portable C++ code as an intermediate language, which is then compiled to a native executable binary. This enables easy interoperability with existing C/C++ frameworks and libraries on a number of platforms.


Please note that this project supersedes pure11 (they are no longer the same)

Please see changes for more details.


Performance

Differences from PureScript:

Other notes:

Future ideas:

Requirements for building the compiler itself

Requirements for using it

Getting Started

This assumes you are running macOS (OS X) or a Unix-like system (Linux, *BSD, etc.).

  1. Make sure you have developer tools for your system installed. For macOS, you'll need a recent version of Xcode. For Linux, etc., you need gcc 4.9.2 or later, including g++ support. You can also use clang 3.5 or later, but it still requires gcc for its C++ standard libraries.

  2. Create a working directory wherever you like, and a src subdirectory under it, which will be where you will place your own PureScript source files.

  3. Under your working directory, also create an ffi subdirectory, which will be where you will place C/C++ FFI source files.

  4. Generate the default GNU Makefile in your working directory by running pscpp --makefile.

  5. Use PureScript's standard psc-package utility to add and manage package dependencies.

  6. You should now be ready to build a PureScript program: