The Internet Of Things example illustrate the composition of Languages.
Based on a Language able to define a System with boards and services, we merge another Language to describe interfaces for theses services, the Lua Language to define the implementation the services and an Activity Language to define the behavior of the System

package fr.inria.diverse.iot2

// This is a simple comment
language Idl4Emf {
  syntax "/org.csu.idl.idlmm/model/IDLMM.ecore"
  exactType Idl4EmfMT
}

language ActivityDiagram {
  syntax "/org.xtext.activitydiagram.model/model/activitydiagram.ecore"
  with org.xtext.activitydiagram.semantics.*
  exactType ActivityDiagramMT
}

/**
 * This is another one
 */
language Lua {
  syntax "/org.xtext.lua/model/generated/Lua.ecore"
  with org.xtext.lua.semantics.*
  exactType LuaMT
}

language IoT2 {
  syntax "/fr.inria.diverse.iot2.model/model/IoT2.ecore"
  slice Idl4Emf
    on ["OperationDef", "PrimitiveDef"]
    renaming { "idlmm" to "iot2" }
  merge Lua renaming { "lua" to "iot2" }
  merge ActivityDiagram renaming { "activitydiagram" to "iot2" }
  with fr.inria.diverse.iot2.OpaqueActionAspect
  with fr.inria.diverse.iot2.OperationDefAspect
  with fr.inria.diverse.iot2.ExpressionAspect
  exactType IoT2MT
}

Sources

Language workbench

clone the git repo https://github.com/diverse-project/melange-examples and import the following projects from https://github.com/diverse-project/melange-examples/tree/master/IoT2

  • org.csu.idl.idlmm
  • org.xtext.activitydiagram.model
  • org.xtext.activitydiagram.semantics
  • org.xtext.lua
  • org.xtext.lua.semantics
  • fr.inria.diverse.iot2.model
  • fr.inria.diverse.iot2