I came across this article via Slashdot, which seems to be an abridge of an article that I’d already seen via lambda the ultimate.

 

The idea of extensible programming languages is interesting one but not a particularly a new one and nor do I think xml is the right tool for solving these problems.

 

XML as a programming language

 

XML is a good way of representing data, especially if the data needs to be passed between systems or serialised for storage. This is because there are well established API for processing xml so you don’t need rewrite a parser for each data format. It is also more human readable than some other formats.

 

But just because it is easier to read than some other data formats doesn’t mean it is particularly good for expressing programs, in fact expressing things that most people have come to expect from programming languages such as assignments or label associations, in a way that people have come to expect, is pretty difficult because of the tag based nature of the language. I also have some practical experience of using xml based languages from my programming in WIX and, well, they just look plain ugly to me. So for the consumers of xml things are two great.

 

The only advantage xml based languages to the extenders of XML based languages is that the abstract syntax tree code be exposed to them thought the DOM interface. But is this really an advantage? Would it be that hard to come up this a better API for exposing the AST? Give that large number of ways to represent an AST (the .NET framework has two API build in to it that do a very similar job, that is, CodeDom and Reflection) I think answer is yes.

 

The idea of programming language extensibility

 

Even if you discount C text marcos as not a very good way to extend a languages functionality, the idea of programming language extensibility has still been around for a while. It is used in a lot in functional programming a lot, a common pattern in functional programming is to design a domain specific language (or little language) to describe a problem then use this domain specific language to solve the problem.

 

Extensible programming languages are already here

 

I’ve been looking at language called Nemerle as part of a wider study on the .NET framework. Put simply Nemerle’s big idea is to expose the compilers AST to the programmer so that they can create Turing complete macros for the language. It’s a powerful idea, concepts that are usally hard code into the compiler, like a for loop, are implement as macros in nemerle. It’s still at the research stage so its difficult to call how well if works in practice, but worth taking a look if you are interested in programming language extensibility.

Feedback:

Feedback was imported from my only blog engine, it's no longer possible to post feedback here.

re: Extensible programming languages - RichB

You should also have a look at lcsc - an easily extendable C# compiler from Microsoft Research. In fact, the concurrent programming extensions in Cw (COmega) were originally in a language called Polyphonic C# which was implemented on top of lcsc's AST.

re: Extensible programming languages - Robert Pickering

Thanks for the tip, but is lcsc publicly available? I've checked the downloads page (http://research.microsoft.com/research/downloads) and the only lcsc item is "LCSC benchmark", which appears to be a bench marking tool built in on top of LCSC.

re: Extensible programming languages - booer

Check this out:
http://boo.codehaus.org/

...specially "syntactic attributes" and "syntactic macros":

http://boo.codehaus.org/Boo+Compiler

re: Extensible programming languages - Thomas Mertes

I do not think that XML is the answer to everything. An extensible programming language should IMHO not be XML based. Being an extensible programming language means: User defined statements, operators and declaration constructs. High level constructs should make an extensible programming language easily readable by humans. XML has the opposite goal of being easy readable by programs. I am biased, but take a look at Seed7.

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language:
User defined statements and operators,
abstract data types, templates without
special syntax, OO with interfaces and multiple
dispatch.