by pure-c

pure-c / purec

C backend for PureScript

195 Stars 6 Forks Last release: Not found 253 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


An alternative backend for the PureScript programming language that targets C.


PureScript is a high-level, statically typed, functionally pure programming language that enables various backends using its intermediate representation of elaborated programs.

PureC provides a backend that transpiles to the C programming language, thus enabling native, ahead-of-time compilation of PureScript programs. With a dead simple FFI to C, performance critical sections can easily be implemented outside of PureScript when the need arises.

For an example of how PureC could be used, take a look at pure-c, a project implementing both purescript-aff and bindings to libuv on top of PureC.


  • Write programs in PureScript
  • Simple FFI to C
  • Generates readable, human- and machine-debuggable C
  • Garbage collected (Boehm)


  • Scrap your node.js
  • Write small, easy to distribute command line utilities

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

For now, the default makefiles use the clang compiler toolchain. So either install clang (if not installed already), or open a PR adding support for other compilers.


  • Install node.js, including
make deps

Build the purec utility

make purec

Running the examples

Each example is an isolated example of how to use purec. You can cd into each of these directories and invoke


To build all examples:

make examples

To run a particular example:

# ./examples//main.out
# example:

Running the tests

make test


Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.


This project is alpha quality and will likely remain alpha quality for a while. That means for now there's one version, and that's



See also the list of contributors who participated in this project.


This project is licensed under the MIT License - see the LICENSE file for details


  • uthash - A hash table for C structures
  • vec - A type-safe dynamic array implementation for C
  • ccan - The C Code Archive Network
  • purescript-native - An experimental C++11/native compiler backend for PureScript

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.