author | Christian Urban <christian.urban@kcl.ac.uk> |
Thu, 12 Nov 2020 12:18:51 +0000 | |
changeset 801 | 7aab258bf72a |
parent 742 | b5b5583a3a08 |
permissions | -rw-r--r-- |
408
5322e1c46890
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1 |
def rev(r: Rexp) : Rexp = r match { |
5322e1c46890
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2 |
case ZERO => ZERO |
5322e1c46890
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
3 |
case ONE => ONE |
5322e1c46890
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
4 |
case CHAR(c) => CHAR(c) |
5322e1c46890
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
case ALT(r1, r2) => ALT(rev(r1), rev(r2)) |
5322e1c46890
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
6 |
case SEQ(r1, r2) => SEQ(rev(r2), rev(r1)) |
5322e1c46890
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
7 |
case STAR(r) => STAR(rev(r)) |
5322e1c46890
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
8 |
} |