From 04d62df9fdd42c603fad7bb1b5e3fb49bf8550c1 Mon Sep 17 00:00:00 2001 From: Malte Voos Date: Mon, 17 Jun 2024 17:41:38 +0200 Subject: implement typechecking --- lib/Reporter.ml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lib/Reporter.ml (limited to 'lib/Reporter.ml') diff --git a/lib/Reporter.ml b/lib/Reporter.ml new file mode 100644 index 0000000..c86a04a --- /dev/null +++ b/lib/Reporter.ml @@ -0,0 +1,28 @@ +module Message = +struct + type t = + | SyntaxError + | IllTyped + | UnboundVariable + | CannotInferType + + let default_severity : t -> Asai.Diagnostic.severity = + function + | SyntaxError -> Error + | IllTyped -> Error + | UnboundVariable -> Error + | CannotInferType -> Error + + let short_code : t -> string = + function + | SyntaxError -> "E0001" + | IllTyped -> "E0002" + | UnboundVariable -> "E0003" + | CannotInferType -> "E0004" +end + +include Asai.Reporter.Make(Message) + +let invalid_local_name (name : Ast.raw_ident) = fatalf SyntaxError "invalid local variable name `%a`" Ast.dump_raw_ident name + +let expected_universe fmt x = fatalf IllTyped "expected a universe but got %a" fmt x \ No newline at end of file -- cgit 1.4.1