There are many human languages. No problem, we like that. There are many computer languages. We disgust it. Most of these languages can do the same. I think we could do with only a few. One object oriented, one for low-level progamming (C), one for scripting, one for functional languages and may be two more. The reason for calling this topic Uml2Babel is that we want to have one model. We want our tower of Babel and not all the languages that came there after.

In UML2 not only the model, but action semantics as well can be saved. The question is: Is it possible to use uml2 for generating all the different languages. Even languages that are used for parallel processing?

At the moment Uml2Babel is a program written in java. It can read Uml2 (EMF) models. And as of now (version 0.33) it can produce some java code. The next step will be to produce some python code (a scripting language with some class concepts). To produce code for parallel languages will not be an option at the moment. The tools for producing Uml2 models just do'nt support it as far as known.


There is more than one tool to produce UML2 models. The tool we will use is TextUml. It is a tool for programmers. You can wite down your model in text. And using an add-in you produce the corresponding graphical representation.

The text is saved in a file with extension .tuml and it will automatically generate a (Eclipse EMF) uml2 model. This model can be read using standard procedures for reading EMF uml2 models. TextUml is capable to save also action semantics, to use stereotypes and to use generics. So, it is like a full-fledged object oriented language. But it seems there is still a lot to be done.

Interface with EMF repositories

The interface with EMF repositories is standard. But not necessarily easy. To read a model produced with TextUml you will have to deal with extensions introduced by TextUml. If you use the file base.tuml as an include file you will see that within that file a number of closures are present in the Collection classes, like operation forEach(predicate : {(:T)});of class Collection<T>.

Interface with Uml2

The interface of Uml2 is simplified to produce a language from the uml2 model. All classes in the interface contain a uml2 class. E.g. there is a class UmlClass and guess what, it contains an object of org.eclipse.uml.uml2.class. All classes in the interface have a method getUml2() that gives you access to the underlying uml2 class.

More information on Uml2Babel

In the following pdf file uml2babel we will present more documentation on the code of the project (more to follow).

In the next two files tuml code , and java code you can see a file with TextUml code and the produced Java code (only for class AStar). It is not perfect but some improvements at least will not be difficult to do.

versie: 17 augustus 2009; copyright: Drikus Kleefsman