Paper accepted at MiSE@ICSE 2013: A model-based approach to language integration

We got recently a paper accepted at the workshop on modeling in software engineering. The paper was written with Antonio Vetrò, Marco Torchiano, Markus Völter and Bernd Kolb.

Applications nowadays are written using more than one language: typically some sort of general purpose language and a constellation of complementary languages (SQL, HTML, XML, Scripting languages, DSLs).

Between artefacts written in different languages there are relations of various kinds, at least references (for example some ID have to be the same in a Java file and in an XML file). The problem is that we miss a general approach to check those relations and ensure global consistency.

In our paper we discuss the problem and present a simple, preliminary approach to solve it inside language workbench. Finally we discuss a research agenda for language integration.

If you want to read the paper, the pdf is available here.

Using a language workbench for language integration

Nowadays each project is realised using a plethora of languages. Think about some classical scenarios:

  • A web application: Css, Javascript, Html and a general purpose language for server side elaborations (for example Java)
  • A Java framework using XML for configuration
  • SQL snippets embedded in a general purpose language

In this scenarios different languages have to interact. The problem is that normally development tools are able to verify just intra-language consistency: it means that an IDE is able to understand if in your java code you are referring to a Java class that does not exist (maybe because you misspelled the name). IDEs are not able to verify inter-language consistency, so for example it does not know if the XML configuration file contains the name of an existing Java class or not. This is a problem of language integration.

I think language workbenches permit to improve a lot language integration, with a limited effort.

Still there is a lot to be done.

Me, Antonio Vetrò, Marco Torchiano, Markus Völter and Bernd Kolb got a paper accepted at MiSE@ICSE’13 about this topic. In the paper we:

  • discuss about the problem of language integration in different scenarios,
  • refer to some previous work (from me, Vetrò and Torchiano) which starts an empirical evaluation of  the issue,
  • present a prototypal micro-implementation of a solution using Jetbrains MPS,
  • present a research agenda for language integration.

Screenshots and more details are on the paper (available as PDF).



The C to mbeddr-C importer: a first look

Currently I am in Munich, working at Fortiss, an institute of the Technische Universität München. I am here to work on mbeddr, which is a super-cool project.

mbeddr supports embedded software development based on an extensible
version of C language and IDE. Existing extensions include interfaces with pre- and postconditions, components, state machines and physical units, as well as support for requirements tracing and product line variability. Based on these abstractions, mbeddr also supports formal verification based on model checking and SMT solving.

What it means in practice?

We are using a Jetbrains MPS to build an extensible variant of C. Using mbeddr the user could write plain C code and use, when it is needed, some extra features.

One example? State machines. Instead of manually encoding them using a bunch of switch the user could use specific constructs. Some advantages:

  • it is less error prone,
  • it is faster,
  • the editor understand what you are doing and catch your errors,
  • you can verify that some properties holds (e.g., are all the states reachable?)

In other words mbeddr permits to work to higher levels of abstractions.

How C and mbeddr-C differs

Mbeddr supports almost all the features of C. It does not support error-prone features like the preprocessor. For most of the usages of the preprocessor mbeddr offers higher-level constructs. Consider for example variability. In C you would see this code:

In mbeddr-C you would write something like:

Variability in mbeddr


in practice you have the possibility to decorate statements and functions with their presence condition. This is cool for many reasons, first of all the possibility for mbeddr to verify that your code is valid under every possible configuration.

What is my contribution?

I am building the importer which converts plain C to mbeddr-C. It interprets how the preprocessor is used in C code and translate it to higher level concepts.

In this video I show the current state of the importer.


If you want some more details about the importer you can read this very preliminary paper, accepted for the Reverse Engineering workshop to be held in Genova on the 5th of March.