package cairn

  1. Overview
  2. Docs

Signature of the modules produced by this library. Common to Make and MakeWithDefaultMessage. Contains functions to get a log of the execution of the parser, as long with a graphical explorer of this log.

val state_to_lr0_list : int -> string list

Function that associates to a lr1 state number a list of string representing the lr0 items it contains.

val parse : string -> Stdlib.Lexing.lexbuf -> Parser.value_parsed option * ParserLog.configuration list * (string * string * string) list

parse text lexbuf parses an input pointed by lexbuf whose content is text. text and lexbuf might be obtained with MenhirLib.LexerUtil. It returns (value,log,errors), where:

  • value is either Some value if the parser produced a semantical value or None.
  • log is a configuration list that represents the execution of the parser (to be used with functions from ParserLog alongside state_to_lr0_list).
  • errors is a list of error messages encountered along the execution, in order to which they appeared. If this list is not empty, value should probably not be trusted. The first string is the position of the error, the second the two tokens between which the error occured, and the last an explanation (from the ParserMessages provided).
val parse_interactive : string -> Stdlib.Lexing.lexbuf -> Parser.value_parsed option

parse_interactive text lexbuf parses an input pointed by lexbuf, whose content is text. Displays a terminal user interface allowing to navigate the log of the parser. Then returns the parsed value (if no error was encountered, None otherwise).

val parse_log : string -> Stdlib.Lexing.lexbuf -> string -> string -> Parser.value_parsed option

parse_log text lexbuf log_file error_file parses an input pointed by lexbuf, whose content is text. Writes a log of the parser execution in the file of name log_file and an error log in the file of name error_file. Returns the parsed value (if no error was encountered, None otherwise)

val parse_interactive_or_log : string -> Stdlib.Lexing.lexbuf -> bool -> string option -> string option -> Parser.value_parsed option

parse_log text lexbuf interactive log_file error_file parses an input pointed by lexbuf, whose content is text. Displays a terminal user interface allowing to navigate the log of the parser if interactive is true. Writes a log of the parser execution in the file of name log_file if it is not None and an error log in the file of name error_file if it is not None. Returns the parsed value (if no error was encountered, None otherwise)

OCaml

Innovation. Community. Security.