Module Frontend.Parse

Some complicated stuff to get the custom syntax errors out of Menhir's Incremental API

val parse_file : (Stdlib.Lexing.position -> Ast.untyped_program Parser.MenhirInterpreter.checkpoint) -> string -> (Ast.untyped_program, Errors.t) Core.result * Warnings.t list

A helper function to take a parser, a filename and produce an AST. Under the hood, it takes care of Menhir's custom syntax error messages.

val parse_string : (Stdlib.Lexing.position -> Ast.untyped_program Parser.MenhirInterpreter.checkpoint) -> string -> (Ast.untyped_program, Errors.t) Core.result * Warnings.t list
val parse : (Stdlib.Lexing.position -> Ast.untyped_program Parser.MenhirInterpreter.checkpoint) -> [< `Code of string | `File of string ] -> (Ast.untyped_program, Errors.t) Core.result * Warnings.t list

A helper function to take a parser and a code or a filename and produce an AST.