Sadek Drobi’s Blog

July 29, 2007

OBSEV :: Java or C# do not fit as a host language for DSLs, Lua is a better alternative to use as an IL in a Meta programming System

 

Recently, I’ve been playing a lot with Meta programming System of JetBrains. I feel that it has a lot in common with my idea of Paradigm Oriented Programming. In the way that it defines the language by links, adjectives and things (i.e. dimensions) that form together an abstraction as a language for a certain domain.

The package comes with Java already implemented, that can be quite handy, as it makes it easy for us to embed languages and concepts inside Java. But there is something that bothers me here; does Java (or even C#) work as an IL, a basic flexible language that other designed DSL will be interpreted to? Actually I strongly doubt that. First of all Java syntax comes already with a lot of constrains, static typing, curly brackets and a lot of other imitations.

Another thing is that Java itself is already an implementation of an abstraction. That is OOP. And fitting everything into OOP will force our DSL to respect that style of programming and to be constrained by it. Java is so static, and neither flexible not dynamic enough to have DSLs built on it.

Fortunately JetBrains’s MPS is not exclusive for java. It rather can be used with any other programming language. Because what it does is to build a coherent structure of text with its grammar in a syntax tree. Then it allows text to be generated out of properties of the syntax.

I thought a lot about a language that can be flexible enough, so that we can build abstractions that can be easily interpreted and implemented into that language’s syntax. I guess Lua is a good candidate. I believe that the way it is built permits a lot of dynamism for implementing meta-systems and making them co-exist in a paradigm oriented programming (See OOP implementation in Lua).

I still see some improvements still can be added to it. But for now I see it a perfect fit as an intermediate language for my POP.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress