Awesome
XBitsy
XBitsy is an interpreter for the Bitsy language implemented in Elixir.
Bitsy
Bitsy is a programming language which aims to be the best language to implement when building your first compiler or interpreter. It is a resource for programmers learning about language design.
To learn more about Bitsy or to try implementing it yourself, in your favorite language, check out the runnable, test based language specification, BitsySpec.
You can read more about the motivation behind creating Bitsy on the ScopeLift Blog.
For an alternative implementation of Bitsy, check out the BitsySwift compiler.
I spoke about creating Bitsy and implementing it in Swift at 360iDev and Indie DevStock. Videos forthcoming!
Requirements
XBitsy requires Elixir 1.3.2 or later. It has been tested on OS X El Capitan (10.11.6), but should work on other versions of OS X/macOS or Linux without issue. If you have one, please report it!
Installation and Usage
To "install" XBitsy, simply clone the repository and run mix escript.build
This places a runnable xbitsy
"binary" in the main directory, which can be
pointed at any Bitsy source file.
git clone https://github.com/apbendi/xbitsy.git
cd xbitsy
mix escript.build
./xbitsy examples/fibonacci.bitsy
Contributing
Contributions of all types are welcome! Open an issue, create a pull request, or just ask a question. The only requirement is that you be respectful of others.
Please checkout the BitsySpec repo and join the discussion to codify version 1.0 of the Bitsy language specification.
Resources
While Bitsy has been created partially in response to a perceived lack of approachable resources for learning language implementation, there are still some good places to start. The resources focus on language compilation, but building a compiler or an interpreter shares much in common.
- Let's Build a Compiler; this paper from the late 80's (!) is an excellent introduction to compilation. The biggest downside is the use of Pascal and m68K assembly. While working through this tutorial, I partially translate his code to Swift.
- The Super Tiny Compiler is a great resource by James Kyle- a minimal, extremely well commented compiler written in JavaScript. Be sure to also checkout the associated conference talk
- How to implement a programming language in JavaScript is a slightly more advanced resource which is, for better or worse, also written in JavaScript.
- A Nanopass Framework for Compiler Education (PDF)
- Stanford Compiler Course with Alex Aiken; an advanced resource for learning some theory and going deeper.