-
Notifications
You must be signed in to change notification settings - Fork 0
/
hs.cl
executable file
·67 lines (41 loc) · 1.09 KB
/
hs.cl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
(* hairy . . .*)
class Foo inherits Bazz {
a : Razz <- case self of
n : Razz => (new Bar);
n : Foo => (new Razz);
n : Bar => n;
esac;
b : Int <- a.doh() + g.doh() + doh() + printh();
doh() : Int { (let i : Int <- h in { h <- h + 2; i; } ) };
};
class Bar inherits Razz {
c : Int <- doh();
d : Object <- printh();
};
class Razz inherits Foo {
e : Bar <- case self of
n : Razz => (new Bar);
n : Bar => n;
esac;
f : Int <- [email protected]() + g.doh() + e.doh() + doh() + printh();
};
class Bazz inherits IO {
h : Int <- 1;
g : Foo <- case self of
n : Bazz => (new Foo);
n : Razz => (new Bar);
n : Foo => (new Razz);
n : Bar => n;
esac;
i : Object <- printh();
printh() : Int { { out_int(h); 0; } };
doh() : Int { (let i: Int <- h in { h <- h + 1; i; } ) };
};
(* scary . . . *)
class Main inherits IO {
a : Bazz <- new Bazz;
b : Foo <- new Foo;
c : Razz <- new Razz;
d : Bar <- new Bar;
main(): String { { out_string("\n") ; "do nothing" ; } };
};