45 lines
647 B
Common Lisp
45 lines
647 B
Common Lisp
|
|
(* Example cool program testing as many aspects of the code generator
|
|
as possible.
|
|
*)
|
|
|
|
class A inherits IO {
|
|
attr_A_1 : Int <- 10;
|
|
attr_A_2 : Bool <- false;
|
|
attr_A_3 : A <- self;
|
|
method_common(x1: Int) : SELF_TYPE {
|
|
self
|
|
};
|
|
method_common2() : String {
|
|
"A"
|
|
};
|
|
};
|
|
|
|
class B inherits A {
|
|
|
|
};
|
|
|
|
class C inherits A {
|
|
attr_C_1 : String <- "This is C\n";
|
|
method_common(x1: Int) : SELF_TYPE {
|
|
self
|
|
};
|
|
method_common2() : String {
|
|
"C"
|
|
};
|
|
method_1(x1: Int) : Bool {
|
|
true
|
|
};
|
|
};
|
|
|
|
class D inherits C {
|
|
method_common(x1: Int) : SELF_TYPE {
|
|
self
|
|
};
|
|
};
|
|
|
|
class Main inherits IO {
|
|
main():Int { 0 };
|
|
};
|
|
|