Practical Development of Programming Languages

1 minute read

In this post I’ll comment about the tools I’m using for developing Marco.

Java

The actual code is written in Java, using an Object Oriented approach. This is not actually quite common, since the mapping between the concepts in different paradigms is not at all obvious. Most languages do some sort or automatic byte code generation (like Clojure) or use procedural Java (using mainly static methods, like Ioke).

IntelliJ

IntelliJ is, in my opinion, by far the most amazing IDE ever conceived. It greatly increases the speed I write code (I rarely ever write a whole line of code by myself). It also has great support for refactoring, and combined with Java static type system, it allows me to make major changes to the code in a safe way.

Antlr

Parsing is one of the most basic tasks you need to take care of when writing a programming language. In my opinion, it is also one of the most annoying and meaningless. It’s not particularly difficult, compared to some of the other problems you have to solve, but it’s very tedious and error prone. It is not something I would like to focus on.

Antlr allows me to tackle exactly that problem: I can write the grammar in a language that is easy to use and maintain, and Antlr will generate the parser for me (more or less, more on parsing later).

The downside is the runtime dependency on Antlr. I’d rather have no runtime dependencies.

Groovy

I use Groovy for writing tests for Marco. Groovy is a great language for writing DSLs, and tests written using the Spock Framework are very easy to write and to read. So far it has been the best testing setup I have ever used.

Gradle

Gradle is the build system I use to replace Ant or Maven. It uses a Groovy DSL instead of XML. It’s very easy to setup and use. It really gets out of your way. I have also tried Buildr and didn’t feel like it worked well for me.

Gradle also integrates well with IntelliJ, by generating the project files for me. It also builds and runs the Groovy tests and generates the antlr grammars. All that with very little code.

Comments