Java C HTML Shell Xtend JavaScript Other
Switch branches/tags
Nothing to show
Fetching latest commitโ€ฆ
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
compilers Fixed Binary MQTT on Java Sep 28, 2017
testframework more outputX Apr 4, 2017
testing Cleaned up and added a few Checker tests Oct 16, 2017
.gitignore .gitignore compilers bundle MANIFEST Jun 23, 2017
Jenkinsfile Modified Jenkinsfile to generate new report Aug 4, 2017
Logotype_ThingML_100317_500px.png logo Mar 16, 2017


The ThingML approach is composed of i) a modeling language, ii) a set of tools and iii) a methodology. The modeling language combines well-proven software modeling constructs for the design and implementation of distributed reactive systems:

  • statecharts and components (aligned with the UML) communicating through asynchronous message passing
  • an imperative platform-independent action language
  • specific constructs targeted at IoT applications.

The ThingML language is supported by a set of tools, which include editors, transformations (e.g. export to UML) and an advanced multi-platform code generation framework, which support multiple target programming languages (C, Java, Javascript). The methodology documents the development processes and tools used by both the IoT service developers and the platform experts.

ThingML is distributed under the Apache 2.0 licence, and has been developed by @ffleurey and @brice-morin of the Networked Systems and Services department of SINTEF in Oslo, Norway, together with a vibrant open-source community. ThingML is now owned by Tellu, but remains open-source.

Issues, bug reports and feature requests should be submitted to the issue tracker on GitHub

๐Ÿ”ท Prerequisites โ—

ThingML can compile code for various platforms and languages. Please make sure you follow the required steps

๐Ÿ”น Java

If you are going to compile Java code from ThingML, please:

  • Make sure you have a proper JDK (a JRE is not sufficient)
  • Install Maven

๐Ÿ”น Javascript

If you are going to compile Javascript code from ThingML, for:

  • NodeJS: Install Node.JS
  • Browser: Make sure you have a decent web browser (Chrome or Firefox should work fine, and probably some others)

๐Ÿ”น UML

If you are going to compile UML Diagrams from ThingML, please:

๐Ÿ”น Arduino

If you are going to compile Arduino code from ThingML, please:

๐Ÿ”น Teensy

If you are going to compile Teensy code from ThingML, please:


๐Ÿ”น C

If you are going to compile C code from ThingML, please:

  • Use a C-friendly OS (such as Linux) with a decent build toolchain (make, gcc), potentially in a Virtual Box

๐Ÿ”ท Getting Started

๐Ÿ”น Installation

The easiest way to get started with ThingML is to use the ThingML plugins in the Eclipse IDE.

If you have docker, you can use the build container with Eclipse and ThingML at the thingmleditor repository or the thingmleditor docker hub


  1. Download Eclipse for Java Developers
  2. Install and Launch Eclipse
  3. Install XText plugins: Help -> Install New Software... -> Add... and choose XText as a name and Xtext - as location, and then OK. Select XText and continue with the install procedure โณ
  4. Install the ThingML plugins: Same procedure. Use ThingML - update site, and select ThingML โณ

You are now ready to use ThingML. โœŒ

๐Ÿ”น Compiling ThingML code

Once you have created (or imported) ThingML files in your workspace, simply right click on a ThingML file in order to compile it. A HEADS / ThingML should be present in the menu and you can then select which compiler to use: Java, JavaScript, C, etc.

The ThingML file you want to compile should contain a configuration

The generated code will be located in a thingml-gen folder in your current project

How to compile and run generated Java code

โ— Configure Eclipse so that it uses the JDK: Window -> Preferences -> Java -> Installed JREs (make sure it points to a JDK)

  • Right click on pom.xml (in thingml-gen/java/your-configuration)
  • Run as -> Maven build...
  • In Goals type: clean install exec:java

If Maven claims it cannot find a pom.xml file, change the base directory in the Run as -> Maven build... window using the Workspace... button, so that it points to thingml-gen/java/your-configuration.

How to compile and run generated JavaScript (for the Browser) code

Nothing special. Open the generated index.html file in your System Browser (ideally Chrome or Firefox)

Do not use the default web browser embedded into Eclipse!

How to compile and run generated JavaScript (Node.JS) code

โ— In Eclipse, from this update site: Node.JS -, install Features included in Enide Studio .Features Set and Nodeclipse Node.js .Features Set

  • Right click on package.json (in thingml-gen/nodejs/your-configuration)
  • Run as -> npm install
  • Right click on main.js
  • Run as -> Node Application

How to visualize generated UML (PlantUML) diagrams

โ— Install PlantUML plugins in Eclipse using this update site: (See below for how to install plugins in Eclipse)

  • Window -> Show View -> Other... -> PlantUML

Make sure you have Graphviz installed (see Prerequisites)

How to compile and run generated C code

  • Open a terminal at ...thingml-gen/posix/your-configuration
  • make
  • ./your-configuration

How to compile and run generated Arduino code

  • Open the generated file in the Arduino IDE
  • Compile
  • Upload to your board

For more information about how to use the Arduino IDE and Arduino boards, have a look at the Arduino documentation.

๐Ÿ”ท Compile ThingML from the sources

You need Git, Maven, and a proper JDK8+

git clone
cd ThingML
mvn clean install
cd language
mvn clean install

The command-line interface JAR (containing all you need to compile ThingML files) can be found here:

cd compilers/registry/target
java -jar compilers.registry-2.0.0-SNAPSHOT-jar-with-dependencies.jar
 --- ThingML help ---
Typical usages:
    java -jar your-jar.jar -t <tool> -s <source> [-o <output-dir>] [--options <option>][-d]
Usage: <main class> [options]
    --compiler, -c
      Compiler ID (Mandatory unless --tool (-t) is used)
    --create-dir, -d
      Create a new directory named after the configuration for the output
      Default: false
    --help, -h
      Display this message.
      Default: false
      Display the list of available plugins
      Default: false
      additional options for ThingML tools.
    --output, -o
      Optional output directory - by default current directory is used
    --source, -s
      A thingml file to compile (should include at least one configuration)
    --tool, -t
      Tool ID (Mandatory unless --compiler (-c) is used)

Compiler Id must belong to the following list:
 ??     sintefboard     - Generates C++ based in code for Arduino.
 ??     posixmt - Generates C code for Linux or other Posix runtime environments (GCC compiler).
 ??     java    - Generates plain Java code.
 ??     arduino - Generates C/C++ code for Arduino or other AVR microcontrollers (AVR-GCC compiler).
 ??     UML     - Generates UML diagrams in PlantUML
 ??     browser - Generates Javascript code that can run in common Web Browsers.
 ??     nodejsMT        - Generates Multi-Process Javascript code (one nodejs process per instance) for the NodeJS platform.
 ??     nodejs  - Generates Javascript code for the NodeJS platform.
 ??     posix   - Generates C/C++ code for Linux or other Posix runtime environments (GCC compiler).
 ??     debugGUI        - Generates html/js mock-up for other a ThingML external connector

Tool Id must belong to the following list:
 ??     testconfigurationgen    - Generates test configuration for things annnotated with @test "input # output".

๐Ÿ”ท FAQ

๐Ÿ”น Where can ThingML code run?

Nowhere! Or almost everywhere, from microcontrollers to the cloud!

A ThingML file per se is a design-time specification of the structure (components) and behavior (state machines) of a reactive system. It cannot be directly executed.

A ThingML file can however be compiled (or transformed) to Java/JavaScript/C/Arduino source code, which can in turn be compiled and executed on a platform. Code generated from ThingML has been successfully executed on a large number of platforms: PC Windows/Linux, Raspberry Pi 1, 2 and 3, Intel Edison, Arduino Uno/Mega/Yun/Mini, ESP8266/ESP32, Trinket, Teensy, and probably others.

๐Ÿ”น How to express this or that in ThingML?

A set of tutorials is available here. The tutorials describe the most common features of ThingML. In addition, an extensive set of tests describes pretty much all the concepts available. Have a look there is you wonder how to express something. Should this information be insufficient, have a look below.

๐Ÿ”น How is ThingML formalized?

The ThingML language is formalized into an EMF-based metamodel. The textual syntax is formalized as an XText grammar.

๐Ÿ”น All that code is wonderful, but I need some Science... ๐Ÿ“š

ThingML is backed by a set of scientific publications (PDFs can easily be found on e.g. Google Scholar):

  • Model-Based Software Engineering to Tame the IoT Jungle
    Brice Morin, Nicolas Harrand and Franck Fleurey
    In IEEE Software, Special Issue on Internet of Things, 2017.
  • ThingML, A Language and Code Generation Framework for Heterogeneous Targets
    N. Harrand, F. Fleurey, B. Morin and K.E. Husa
    In MODELSโ€™16: ACM/IEEE 19th International Conference on Model Driven Engineering Languages and Systems. Practice and Innovation track. St Malo, France, October 2-7, 2016
  • MDE to Manage Communications with and between Resource-Constrained Systems
    F. Fleurey, B. Morin, A. Solberg and O. Barais.
    In MODELSโ€™11: ACM/IEEE 14th International Conference on Model Driven Engineering Languages and Systems. Wellington, New Zealand, October 2011.

ThingML has also been used together with other approaches:

  • Agile Development of Home Automation System with ThingML
    A. Vasilevskiy, B. Morin, ร˜. Haugen and P. Evensen.
    In INDINโ€™16: 14th IEEE International Conference on Industrial Informatics. Poitiers, France, July 18-21, 2016
  • A Generative Middleware for Heterogeneous and Distributed Services
    B. Morin, F. Fleurey, K.E. Husa, and O. Barais.
    In CBSEโ€™16: 19th International ACM Sigsoft Symposium on Component-Based Software Engineering. Venice, Italy, April 5-8, 2016

๐Ÿ”น How to embed ThingML in my toolchain?

Embed the command-line inteface JAR described previously in this readme in your classpath.

You can also include ThingML as a Maven dependency in your project:





๐Ÿ”น The code generated by ThingML for Java/JS/C/Arduino does not exactly fit my needs

Rather than being monolithic blobs, compilers are implemented in a modular way around a set of extension points defined in the ThingML Code Generation Framework.

๐Ÿ”น Why can't I generate Go/Python/Lua/Ruby/you-name-it?

Well, it is up to you to implement a compiler for whatever language that is not supported by default. What are you waiting for?

๐Ÿ”น How can I programatically process ThingML models?

File myFile = new File("source.thingml");
ThingMLModel myModel = ThingMLCompiler.loadModel(myFile);
//Do something
ThingMLCompiler.saveAsThingML(myModel, "target.thingml");
ThingMLCompiler.saveAsXMI(myModel, "target.xmi");

Protip1: Make sure you have a good understanding of the ThingML metamodel

Protip2: Have a look at the helper functions which simplify some typical treatments

Models saved this way will contain all the imports that the original file refered to in one big file

This feature might currently be broken as we migrated to XText.

๐Ÿ”ท More

Visit to find out more about ThingML !

ThingML is released under OSI-compliant Apache 2.0 license