My personal records while learning CS143 Compilers of Stanford
Stanford's MOOC
Stanford offical
-------------- Test code -------------
(class (: Test Set) (: n Int)
(= id n)
(: test (-> Test Bool))
(: main (-> (List String) (IO)))
(= (main args)
(print (fst args)))
)
(class (: Testable (Test 0)) (: n Int)
(= (test tt) (== (.id tt) n))
(= (: debug String)
(.+ "Testing" (.toString id)))
)
(= (: obj Test) (new (Testable 0)))
(print (.test obj obj))