As an example DSL, we used a very simple language for describing the behaviour of a telephone remote control system. The idea is that you can call the system with your mobile phone and use your phone's DTMF tones to control something remotely in your house. The DSL looks like this:
main {You can find the slides of the tutorial here and here. There was also a handout that explains step-by-step how to create the DSL prototype. In this folder, there are some code snippets you may find useful if you want to go through this tutorial.
say "main menu";
listen {
1: "control lights" -> lights;
}
}
lights {
say "your lights are";
say lights_status();
listen {
1: "switch your lights" -> switch_lights;
0: "return to main menu" -> main;
}
}
switch_lights {
lights_switch();
say "your lights are now";
say lights_status();
goto main;
}
If you are lazy you can also just download the completed project or watch this screencast showing the prototype in action.
Keine Kommentare:
Kommentar veröffentlichen