Hecl - The Mobile Scripting Language

David N. Welton


Table of Contents

Installation / Tools & Editors
Tools & Editors
Hecl Tutorial
Hecl Commands
Hecl Extension Commands
File Interaction
Interfacing Hecl and Java
Calling Hecl code from Java
Creating new Hecl commands
Building Hecl: Ant Targets
Hecl and Java ME
Hecl Java ME Tutorial
Quick start to developing Java ME apps
Hecl J2ME MIDP1.0 Commands
Hecl Java ME MIDP2.0 Commands
Hacking Hecl's Java ME code
Hecl and BlackBerry
BlackBerry Commands
Hecl and Android
Android Hecl Quick Start


The Hecl Programming Language is a high-level scripting language implemented in Java. It is intended to be small, extensible, extremely flexible, and easy to learn and use.

Why Hecl? Hecl is intended as a complement to the Java programming language, not a replacement. It tries to do well what Java doesn't, and leaves those tasks to Java for which it is best suited, by providing an API that makes it easy to tie the two together. Hecl aims to be a very immediate language - you can pick it up and start doing useful things with it quickly - even people without formal training. Hecl is easy to learn. Where Java is verbose and rigid, Hecl is forgiving and quick to write. For instance, System.out.println("Hello World"); vs puts "Hello World" - 41 keystrokes (shifted letters count double) versus 22. Hecl is built to "scale down" - especially in terms of its users, meaning that it is very quick to learn, and can be quickly put to productive use even by those who are not programmers by trade.

This makes Hecl ideal for large applications written in Java that would like to provide a user friendly scripting interface, rather than, say, a clunky XML based system. Examples include: scripted web pages, command/control logic in long running applications, and, I'm sure, many environments I've never considered. Instead of a simple, static configuration file, you can give your users the power to program portions of the system to do things that you hadn't thought of when you wrote the software originally.

Hecl is a small language with a minimal core. The idea is to provide only what's necessary in the language itself, and as needed, add in extensions for specific tasks. Core Hecl is small enough to run on my Nokia 3100 cell phone as a J2ME application, presenting the interesting possibility of writing scripts, or at some point, maybe even scripting entire applications, for devices running embedded Java.

Contributions in the form of code, ideas, suggestions, or even donations are welcome. Hecl is still growing, so your thoughts are important, and you can help shape the language's future. You can download the latest source code via git from github: http://github.com/davidw/hecl/tree/master.

Hecl is available under the liberal Apache 2.0 open source license. Which says, more or less, that you may use Hecl in your own applications, even if they are not open source. You have to give the authors credit, though. Read the license itself to clear up any doubts. Incidentally, I don't see the license as being incompatible with the GPL, so feel free to utilize Hecl in your GPL product (I have added a note to this effect in the NOTICE file that must accompany products using the Hecl code).

I owe thanks to a lot of people for Hecl. First and foremost the creator of the Tcl programming language, Dr. John Ousterhout. While I have attempted to improve some things that I did not care for in Tcl, it is obvious that the simple, extremely flexible command-based approach that Hecl takes is derived from Tcl. I also borrowed some ideas from the (mostly defunct) Jacl implementation of Tcl in Java. Many thanks are also due my friend Salvatore Sanfilippo, with whom I have spent many hours discussing Hecl, Tcl, and the philosophy of programming languages in general. And of course, I owe a huge debt of gratitude to my wife, Ilenia, who puts up with all the hours I spend in front of "that damn computer".