Module Frontend.Errors

Some plumbing for our compiler errors

type syntax_error =
  1. | Lexing of Middle.Location.t
  2. | UnexpectedEOF of Middle.Location.t
  3. | Include of string * Middle.Location.t
  4. | Parsing of string * Middle.Location_span.t

Our type of syntax error information

exception SyntaxError of syntax_error

Exception for Syntax Errors

exception SemanticError of Semantic_error.t

Exception SemanticError (loc, msg) indicates a semantic error with message msg, occurring at location loc.

type t =
  1. | FileNotFound of string
  2. | Syntax_error of syntax_error
  3. | Semantic_error of Semantic_error.t
  4. | DebugDataError of Middle.Location_span.t * string
val pp : ?printed_filename:string -> ?code:string -> t Fmt.t

Pretty-printer for error type t. Replace occurances of filename from locations with printed_filename, if supplied. If code is supplied, read context from that string. Otherwise, it will attempt to open the original file.

val to_string : t -> string

Format an error t as a string. Should only be used in testing! For user facing code, prefer pp