Thursday, July 18, 2013

New work on the Jiffle compiler

Jiffle is a scripting language for raster algebra. It can be used for stand-alone applications, or as the basis for image or map calculators (e.g. the JGrassTools Mapcalc module). If you haven't met Jiffle yet, take a look at the user guide and some of the previous posts about the language such as Jiffle meets Mandelbrot and Jiffle plays the Game of Life.

The Jiffle compiler is built on the fabulous ANTLR parser generator. To date, Jiffle has used ANTLR version 3 and many compilation tasks such as syntax checking, optimization and translation to Java sources involve Java code embedded directly within the ANTLR grammar files. It all works but it's messy, brittle and hard to follow.

We are now moving to ANTLR version 4 which encourages a very different approach with simpler, language-neutral grammars processed by visitors and/or listeners coded as ordinary Java classes. This promises to make the Jiffle compiler sources much easier to understand, maintain and extend.

For Jiffle users, few if any changes will be evident on the outside at first: the Jiffle language itself will stay the same and all existing scripts will still run. The high-level parts of the API for Java clients (e.g. the JiffleBuilder class) will also remain much as they are. But later on, the new compiler will make it easier to add new language features and extend the API.

Stay tuned...

1 comment:

  1. Staying tuned ... now where is the dial on this thing. Darn digital radio.