A small, fast, native lisp with "magical" powers
Pixie is a lightweight lisp suitable for both general use as well as shell scripting. The standard library is heavily inspired by Clojure as well as several other functional programming languages. It is written in RPython and as such supports a fairly fast GC and an amazingly fast tracing JIT.
Pixie implements its own virtual machine. It does not run on the JVM, CLR or Python VM. It implements its own bytecode, has its own GC and JIT. And it's small. Currently the interpreter, JIT, GC, and stdlib clock in at about 10.3MB once compiled down to an executable
If you like Clojure, but are unhappy with the start-up time, or if you want something outside of the JVM ecosystem, then Pixie may be for you. The language is still in a "pre-alpha" phase and as such changes fairly quickly.
It's quite straight forward to go to Neverland
(println "Goodbye world!") (loop [x 5] (when (> x 0) (print (str x "\n")) (recur (- x 1)))) ;And we're off (println "Hello Neverland!")
A bit more about the magic
So this is written in Python?
It's actually written in RPython, the same language PyPy is written in. make build_with_jit will compile Pixie using the PyPy toolchain. After some time, it will produce an executable called pixie-vm. This executable is a full blown native interpreter with a JIT, GC, etc. So yes, the guts are written in RPython, just like the guts of most lisp interpreters are written in C. At runtime the only thing that is interpreted is the Pixie bytecode, that is until the JIT kicks in...
What's this bit about "magical powers"
First of all, the word "magic" is in quotes as it's partly a play on words, pixies are small, light and often considered to have magical powers.
However there are a few features of pixie that although may not be uncommon, are perhaps unexpected from a lisp.
- Pixie implements its own virtual machine. It does not run on the JVM, CLR or Python VM. It implements its own bytecode, has its own GC and JIT. And it's small. Currently the interpreter, JIT, GC, and stdlib clock in at about 10.3MB once compiled down to an executable.
- The JIT makes some things fast. Very fast. Code like the following compiles down to a loop with 6 CPU instructions. While this may not be too impressive for any language that uses a tracing jit, it is fairly unique for a language as young as Pixie.
;; This code adds up to 10000 from 0 via calling a function that takes a ;; variable number of arguments. ;; That function then reduces over the argument list to ;; add up all given arguments. (defn add-fn [& args] (reduce -add 0 args)) (loop [x 0] (if (eq x 10000) x (recur (add-fn x 1))))
(Planned "magical" Features)
- Influencing the JIT from user code. (Still in research) Eventually it would be nice to allow Pixie to hint to the JIT that certain values are constants, that certain functions are pure, etc. This can all be done from inside RPython, and the plan is to expose parts of that to the user via hints in the Pixie language, to what extent this will be possible is not yet known.
- STM for parallelism. Once STM gets merged into the mainline branch of PyPy, we'll adopt it pretty quickly.
- CSP for concurrency. We already have stacklets, it's not that hard to use them for CSP style concurrency as well.
Where can I find other Pixie developers?
Mostly on FreeNode at #pixie-lang or gitter. Stop by and say "hello".
The origins of Pixie
"I've always had it in the back of my head that a lisp on RPython would be a good project."
"I've been a language hacker for years, and have played around with RPython (PyPy’s tool-chain) for some time. I've always had it in the back of my head that a lisp on RPython would be a good project. But it seems like this time it’s really taken off. I started the project about 3 months ago, and by now it’s grown quite a bit. The standard library is about to hit 2000 loc (lines of code), and we have about half a dozen contributors. Not bad for only a few months work." - Timothy Baldridge (2014)Read the full interview with Timothy Baldridge here.