pub fn check(ast: &AST, ctx: &Context) -> TypeResult
Checks whether a given AST is well typed according to the specification of the language.
Any ill-typed AST results in a failure.