Tutorial Week 2 |
Task 1. Write down regular expressions for the following languages.
Task 2. Can you write a regular expressions for the following languages?
Task 3. Think
about how you would represent programs of another
language in Java so that you can efficiently do
something with programs (e.g. print programs to the
console). As an example, take language from the
previous exercise, which has assignments P ::= x := e | if0 e then P else P | whileGt0 e do P | P; P e ::= e + e | e - e | e * e | (e) | e % e | x | 0 | 1 | 2 | ... Design a class hierarchy
based on an suitable interface as base representing
programs in this language. For the language above you
could start with an interface |