zondag 2 oktober 2011

Projects based on subscript

On LinkedIn, someone asked me: "Do you have any examples of publicly accessible projects which based on subscript?". This was my reply:

Subscript is not yet released for application development. The current release is rather meant to raise interest in the programming language community, hoping that others will participate in the development.

There is a predecessor language, Scriptic, which extends Java. Scriptic is also hosted by Google Code. Scriptic is in production use at the organisation I work in, but that project is not publicly accessible. However, I refer to that use extensively in the slides of my lecture at Amsterdam University: http://subscript.googlecode.com/files/Event-driven%20and%20Concurrent%20Programming.ppt See sheets 23 to 30. Some more explanation:

The company I work for works a lot with certain communication protocols, among others. There are in the order of magnitude of 1 million pages in Word documents defining these protocols and their versions. We wanted to process these documents to be able to generate better traversable HTML versions, and to generate code that supports the communication protocols.

For this processing, several approaches have been taken the past years. Parsing was the hard part. It has been done using shell scripts, Perl, plain Java, and JavaCC. IMO these parsers were created with great craftmanship, but they were still hard to read, to maintain and to reuse.

Then Scriptic was used for processing of part the description of one big protocol, with success. The size of the task of parsing input now became comparable to the task of generating output. Low level parsing scripts were easy to reuse.

However, some things could and should be improved. The lessons learnt greatly influenced Scriptic's follow up, Subscript.


zaterdag 1 oktober 2011

Subscript Code Released

I am "finally" happy to announce the initial release of Subscript: an extension of Scala with a theory named Process Algebra.

Subscript aims to ease event-driven and concurrent programming. You can build so called "scripts" with sequences, choices, parallelism and other kinds of compositions, operating on several kinds of actions. These actions may execute normal Scala code, or handle events, or execute code in a new thread or in the GUI thread. Concurrency in Subscript is often lightweight, so without threading, like in the Actor model.

Application areas are: text parsing, GUI controllers (which happen to be much like parsers) and discrete event simulations.

A complete Subscript implementation will contain at least a compiler and a Subscript Virtual Machine (SVM). The compiler would be a extension of a Scala compiler. It will internally translate typical Subscript items to specific Scala methods and other features, in a form that is for the time being called "Internal Script Language" (ISL). The "old part" of the compiler then generates the usual byte code for these features.

This initial release is meant for people interested in programming languages; it is not suitable yet for application developers. The aim of this immature release is to raise interest to participate in further development of the compiler and SVM. I would also welcome comments and suggestions on the Scala code that I wrote; I am still in the process of learning Scala (but it rocks; I don't want to go back to Java and C# any more). No work has been done on the compiler yet. Compilation to ISL is done by hand. There are 3 sample applications that indicate how compilation should be done; it is fairly straightforward.

The SVM code is "don't worry, be crappy" quality. Some basic tracing functionality is provided. The 3 sample applications are the only tested applications, at the moment. Many language features that are not used in the sample applications, will not work. I already included 100% untested code so that it gives an idea what the good code should do.

The project site is http://code.google.com/p/subscript/. It has more sample applications, that I intend to get working during the next few weeks. I also try to explain Process Algebra there, and how I added it onto Scala. And there is a White Paper.

In April 2011 I gave a guest lecture and a workshop at Amsterdam University (where Process Algebra was invented, 30 years ago) for the master's course Thread Algebra. I discussed Subscript and a predecessor language that extends Java. The Google code site has the Powerpoint presentation, and a link to the student assignments used in the work shop.

I am personally very happy with the combination of Scala and Process Algebra. I like the concise function definitions using an equals sign in Scala; this combines well with the Process Algebra style of definitions. I hope many of you will like Subscript, too, and that some of you will participate in the project at Google Code.