66 lines
1.1 KiB
Common Lisp
66 lines
1.1 KiB
Common Lisp
|
|
(*
|
|
* execute "coolc bad.cl" to see the error messages that the coolc parser
|
|
* generates
|
|
*
|
|
* execute "myparser bad.cl" to see the error messages that your parser
|
|
* generates
|
|
*)
|
|
-- lex_error
|
|
*)
|
|
|
|
(* no error *)
|
|
class A {
|
|
};
|
|
|
|
(* error: b is not a type identifier *)
|
|
Class b inherits A {
|
|
};
|
|
|
|
(* error: a is not a type identifier *)
|
|
Class C inherits a {
|
|
};
|
|
|
|
(* error: keyword inherits is misspelled *)
|
|
Class D inherts A {
|
|
};
|
|
|
|
(* error: closing brace is missing *)
|
|
Class E inherits A }
|
|
;
|
|
class A {
|
|
F(x : Int) : Object {
|
|
self
|
|
};
|
|
};
|
|
|
|
class B {
|
|
Y : Int;
|
|
};
|
|
|
|
Class F inherits A {
|
|
scheisse: wrongtype ;
|
|
WrongType: scheisse;
|
|
scheisse <- "no type";
|
|
err_method1(id1: t1);
|
|
err_method2(id1:T1, );
|
|
err_method3(id1:T1):t1;
|
|
err_method4(id1:T1):T1;
|
|
err_method5();
|
|
good_method() : T { hallo <- 2 };
|
|
err_method6() { hallo <- 2 };
|
|
err_block() : T {
|
|
let a:Int <- Broken in {
|
|
error(s:T);
|
|
hello;
|
|
err_(s:T);
|
|
wow();
|
|
}
|
|
};
|
|
err_let() : T {
|
|
{
|
|
let a:Int<-Bork, b:Int<-5, c:Int<-6 in a + B;
|
|
}
|
|
}
|
|
};
|