The Artima Developer Community
Sponsored Link

Heron-Centric: Ruminations of a Language Designer
Superlanguages: Syntactic and Semantic Supersets of other Languages
by Christopher Diggins
March 12, 2008
Summary
I propose the term "superlanguages" to describe languages with extensible syntax, designed for the implementation of domain specific embedded languages and to support language oriented programming, because they effectively provide a superset of the syntax and semantics of other languages.

Advertisement

The following is a revised version of a recent blog entry on my home page that I thought might interest Artima.com readers.


Language oriented programming (LOP), is an idea that has been around for at least 40 years within the Lisp/Scheme community. I believe it was first given the name in 1994 by Martin Ward. The earliest article with the term "Language Oriented Programming" I can find is this article by the same name. A more recent version of Ward's article that was updated in 2003 can be found at http://www.cse.dmu.ac.uk/~mward/martin/papers/middle-out-t.pdf. LOP has been getting some attention lately due in large part to Martin Fowler's essay on Language Workbenches: A Killer App for Domain Specific Languages.

A lot of the work on LOP has been focused on language toolkits (e.g. libraries, editors, workbenches). A closely related idea is Charles Simonyi's concept of Intentional Software (http://www.intentsoft.com/technology/IS_OOPSLA_2006_paper.pdf). To be perfectly honest I am skeptical whether intentional programming is truly distinct from language oriented programming. In the software engineering community a very similar approach called "Language Driven Development" has been gaining traction as described in the online book Applied Metamodelling : A Foundation for Language Driven Development, there is some recent discussion of the book at Lambda-the-Ultimate.org.

The idea of language oriented programming frequently resurfaces in the collective programmer conciousness. For example a recent article by Markus Völter, Architecture as Language: A story, posted on InfoQ, proposes the language oriented programming approach to model-driven architecture without naming it or referring to any tools. This spontaneous recreation of an idea for me is an indicator that it has real substance.

I am not a big fan of language workbenches or the general principle of relying on tool support for my development processes. I was an old-school Atari 400 hacker and I learned to program using nothing but an onion-skin keyboard, and the simplest of text editors. I feel that if you can't do it in text, then forget about it (hence my recent energies devoted to creating a textual mapping of xUML). This is why languages that can be dynamically extended to include the syntax and semantics of radically different programming languages, such as XMF and Kathadin, are so interesting to me. You can work with them from the simplest of command lines.

I have proposed the term "superlanguages" to describe these kinds of languages because they effectively provide a superset of the syntax and semantics of other languages. This term appealed to the creators of XMF who are using it to describe XMF. I might have preferred to use the term metalanguage, because these are languages for defining languages, but this term is already overloaded. ML as in the ML family of languages (e.g. ML, SML, CAML, OCAML) stands for metalanguage. In the language theory community a metalanguage is any language used to define the semantics of another language, but usually not the syntax. An interesting area of research might be the usage of superlanguages as formal descriptions of both the syntax and semantics of a programming language, but I digress.

The idea of a superlanguage is different from languages with a simple metaprogramming protocol such as Common Lisp, Ruby, and Python. For example you can't write the following C-style DSP within Lisp with seriously hacking the reader macros (essentially requiring you to write your own C parser):

  int fib(int x) {
     if (x <= 1) 
        return 1; 
     else 
        return fib(x - 1) + fib(x - 2);
  }

Implementing a C like language (and then jumping out of it in the middle!) was part of a series of challenges I gave the XMF language creators (including defining a Lisp like languages and a PHP-like language). This was for me to see if they are really doing something interesting (as opposed to reinventing Lisp), and it turned out that they were. The XMF team seem to relish new challenges fro defining domain-specific embedded languages. You can see an example of XMF moving in and out of a C-style embedded langauge at http://www.ceteva.com/XMF/Snippets/C/C.html. What perhaps excited me most about XMF, compared to Katahdin which apepars to be at least temporarily on hiatus, is that it has been used in commercial development. It only recently went open-source, and helps demonstrate that there are practical advantages to language oriented programming in general.

Talk Back!

Have an opinion? Readers have already posted 13 comments about this weblog entry. Why not add yours?

RSS Feed

If you'd like to be notified whenever Christopher Diggins adds a new entry to his weblog, subscribe to his RSS feed.

About the Blogger

Christopher Diggins is a software developer and freelance writer. Christopher loves programming, but is eternally frustrated by the shortcomings of modern programming languages. As would any reasonable person in his shoes, he decided to quit his day job to write his own ( www.heron-language.com ). Christopher is the co-author of the C++ Cookbook from O'Reilly. Christopher can be reached through his home page at www.cdiggins.com.

This weblog entry is Copyright © 2008 Christopher Diggins. All rights reserved.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use