I was inspired by the concerted effort to develop so many source-to-source compilers for CodeCombat. It seemed like it would be a great step forward for the platform and that made me interested in contributing. Unfortunately I joined the challenge pretty late and am only a beginner at writing compilers, so I decided to tackle a small, minimal language. I chose Io as it was minimal, elegant, and not so obscure or impractical as to be considered esoteric.

The intended audience was the CodeCombat team, and by extension its users. However, while I believe that my parser can handle some of CodeCombat's levels, it's not yet ready for production use. It is still more of a hobby project in its current state.

A feature I am proud of is the approach I used to support infix operators of variable precedence. Io's operators are syntactic sugar for messages (much like Ruby's), and the set of operators (with associated precedence) can be extended at runtime. Most parser-generators aren't built for this sort of thing, so I was stuck on it for a while. After giving the problem a lot of thought I ended up using a modified operator-precedence parser to make a second pass over the syntax tree, transforming chains of messages into properly nested operators. Tweaks can be made to support prefix, postfix, and right-associative operators as well.

Built With

Share this project: