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.
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.
You must...
You should...
You will have...
You may have...
Structure
To pass this lab...
Assignment 1: MPL & Constraints | Assignment 2: MIL & Interpreter | Assignment 3: Compiler |
---|---|---|
Create metamodel | Create metamodel | Devise encoding of MPL to MIL |
Create grammar (parser & editor) | Create grammar (parser & editor) | Create MPL to MIL compiler (operative semantics) |
Create constraints (static semantics) | Write interpreter (execution environment) | Integrate into Eclipse |
- | Integrate into Eclipse | - |
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 | - | |
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 | - |