TU BRAUNSCHWEIG

Lab on Model-Driven Software Development:
Creating a Model-Based Programming Language

Overview

The lab guides students through the process of designing and realizing an own model-based programming language, writing a compiler to an intermediate language and creating an execution environment revolving around the language's interpreter.

This Lab Creates a Programming Language and its Execution Environment

This Lab Teaches Model-Driven Language Engineering

Formalities

  • Date:
    • Thursday 13:15 – 16:30 on the dates with class room introductions
    • Thursday 15:00 – 16:30 on dates with class room discussions
    • Deviating dates:
      • 1. Class room session: 24.10.18, 10:00 – 11:45
      • 2. Class room session: 29.10.18, 13:15 – 16:30
    • See the timetable for details.
  • Room: IZ 413a, Terminal Room of ISF
  • Language: The slides and assignments of the lab are in English. The lab will be held in English unless there are exclusively German-speaking participants present.
  • Module: This lab is an instance of the module "Softwaretechnik, vertiefendes Praktikum" (INF-SSE-37) and awards 5 ECTS credits.
  • Passing Criteria: To pass the lab, students have to attend the mandatory class room sessions, complete all assignments, implement at least one extension proactively and present their results at the end of the lab. There will be individual grades for completing the lab.
  • Instructors: Dr.-Ing. Christoph Seidl, Prof. Dr.-Ing. Ina Schaefer
  • Registration: Write an email to c.seidl@tu-braunschweig.de to register. To ensure intensive individual tutoring, the attendance for this lab is strictly limited!

Content

In guided tasks, students create a programming language, an intermediate language and the respective execution environment. In a free exercise, students create extensions to the language infrastructure.

Model-Based Programming Language (MPL)

MPL is a Turing complete programming language with variables, calculations, control flow statements and operations. MPL is developed in four revisions with increasing complexity, where the first one is developed in a class-room tutorial and the other three in homework assignments. The resulting metamodel and textual syntax are used to generate an editor.

Model-Based Intermediate Language (MIL)

MIL features an instruction set similar to that of processors with a total of 19 instructions, which are easy to execute. MIL is developed in four revisions that align with those of MPL. In class-room tutorials and homework assignments, students design a metamodel and textual syntax for MIL while learning the semantics of each instruction.

Execution Environment

Instead of executing MPL directly, it is compiled to MIL by model-to-model transformation. Students devise and implement appropriate translations from MPL constructs to MIL instructions. The execution environment for MIL is a hybrid stack/register machine students implement in Java. The implementation is relatively straight forward, which makes it portable so that MIL instructions and, thus, MPL code can be executed on different platforms when necessary.

Extensions to Language Infrastructure

Students follow up on the guided tasks in free exercises where they can choose from a number of potential topics to extend and refine the language infrastructure, e.g., introducing a type system to MPL, creating a graphical programming language that compiles to MIL, writing a debugger for MIL or compiling MIL to a binary format with an interpreter for embedded devices. To complete the lab, students have to realize at least one free exercise topic.

When Starting this Lab, ...

You must... You should...
  • ... know Java programming
  • ... have a background in MDSD
  • ... know Ecore and the Eclipse Modeling Framework (EMF)
  • ... know some basics of compilers
  • ... be interested in ...
    • ... MDSD
    • ... compiler construction
    • ... language design
    • ... software engineering

When Completing this Lab, ...

You will have... You may have...
  • ... created a programming language
  • ... generated a parser
  • ... implemented a compiler
  • ... created an intermediate language
  • ... written a stack/register machine
  • ... implemented an interpreter
  • ... integrated components into Eclipse
  • ... implemented a debugger
  • ... designed a type system
  • ... created a graphical programming language using the intermediate language
  • ... written a compiler to binary byte code
  • ... ported the interpreter to a different programming language

Lab Organization

Structure To pass this lab...
  • Three class room sessions with interleaved tutorials
  • Three assignment sheets
  • Free exercise
  • ... attend mandatory class room sessions
  • ... follow the tutorials
  • ... complete all assignments
  • ... implement at least one free-exercise assignment
  • ... present your final results

Lab Assignments

Assignment 1: MPL & Constraints Assignment 2: MIL & Interpreter Assignment 3: Compiler
  • Create metamodel
  • Create grammar (parser & editor)
  • Create constraints (static semantics)
  • Create metamodel
  • Create grammar (parser & editor)
  • Write interpreter (execution environment)
  • Integrate into Eclipse
    • Devise encoding of MPL to MIL
    • Create MPL to MIL compiler (operative semantics)
    • Integrate into Eclipse

    Each Assignment is to be Completed Iteratively in Four Revisions

    Assignment X
    Task 1 Task 2 Task 3
    Revision 1 Collaborative Work in Class Room
    Revision 2 Individual Work
    Revision 3
    Revision 4

    Timetable

    Week Date and Time Class Room Session Lab Work
    1 24.10.18, 10:00 – 11:45
    18.10.18, 13:15 – 16:30
    Introduction: Lab Overview & Recap Setup Eclipse and MDSD
    2 29.10.18, 13:15 – 16:30
    25.10.18, 13:15 – 16:30
    Introduction: MPL – The Model-Based Programming Language Work on MPL
    3 01.11.18 Discussion: MPL Assignment Work on MPL
    4 08.11.18, 15:00 – 16:30 Discussion: MPL Assignment Work on MPL
    5 15.11.18, 13:15 – 16:30 Introduction: MIL – The Model-Based Intermediate Language Work on MIL
    6 22.11.18 - Work on MIL
    7 29.11.18, 15:00 – 16:30 Discussion: MIL Assignment Work on MIL
    8 06.12.18, 13:15 – 16:30 Introduction: The MPL to MIL Compiler Work on Compiler
    9 13.12.18, 13:15 – 16:30 Discussion: Compiler Assignment, Introduction: Free Exercise Work on Compiler
    10 20.12.18, 13:15 – 16:30 - Work on own Extensions
    x 03.01.19 <Christmas Holidays> -
    11 10.01.19 - Work on own Extensions
    12 17.01.19, 15:00 – 16:30 Feedback: Free Exercise Work on own Extensions
    13 24.01.19 - Work on own Extensions
    14 31.01.19, 13:15 – 15:30 Final Presentations -

      last changed 08.08.2018
    TU_Icon_E_Mail_1_17x17_RGB pagetop