pec embedded compiler

Latest on Hackage:0.2.3

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD3 licensed and maintained by Brett Letner
Introducing the pec language and pec embedded compiler.

The intent of pec is to provide a drop-in replacement for C, but with
modern language features. Pec is a procedural language with a
functional/declarative feel. Programming in pec is very similar to
monadic programming in Haskell. The primary use case for pec is to
provide a productive environment for writing safe, efficient, embedded

Feature list
- Easy C integration
- No garbage collection
- Strong typing with Hindley-Milner type inference
- Safe pointers, no indexing out of bounds
- Variants, arrays, tuples, records, arbitrary sized integers
- User defined, polymorphic data structures
- Parametric polymorphism, limited ad-hoc polymorphism
- Modules
- Compiles to C and LLVM
- Haskell-ish syntax/layout
- BSD license

- type 'make'
- resolve all hackage dependencies
- type 'make' again
- go and get a cup of coffee :)

Pec (the language and the compiler) is in the alpha stage of
development. The compiler is implemented in Haskell and has a very
small codebase (thanks to several existing Haskell tools/libraries).

You can download and install pec via cabal or access the git
repository on github ( You'll need
to have a c compiler installed to build the examples.

Any feedback on the design and/or implementation of pec would be
greatly appreciated :)

brettletner at gmail dot com


Changes since the last release:
- eliminated inline Haskell code in pec syntax (that was an ugly idea :)
- rewrite to better support multiple backends
- added C backend support
- now using grm instead of bnfc
- added stack, queue, deque container types to pec lib
- more test cases including some project euler
comments powered byDisqus