package libsail

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Initial desugaring pass over AST after parsing

Options

val opt_abstract_types : bool ref

Enable abstract types in the AST. If unset, will report an error if they are encountered.

val opt_fast_undefined : bool ref

Generate faster undefined_T functions. Rather than generating functions that allow for the undefined values of enums and variants to be picked at runtime using a RNG or similar, this creates undefined_T functions for those types that simply return a specific member of the type chosen at compile time, which is much faster. These functions don't have the right effects, so the -no_effects flag may be needed if this is true. False by default.

val opt_magic_hash : bool ref

Allow # in identifiers when set, much like the GHC option of the same name

Contexts

type ctx
val merge_ctx : Parse_ast.l -> ctx -> ctx -> ctx
val initial_ctx : ctx

Desugar and process AST

val get_uninitialized_registers : Ast_util.untyped_def list -> (Ast.id * Ast.typ) list
val generate_undefined_record_context : Ast.typquant -> (Ast.id * Ast.typ) list
val generate_undefined_record : Ast.id -> Ast.typquant -> (Ast.typ * Ast.id) list -> Ast_util.untyped_def list
val generate_undefined_enum : Ast.id -> Ast.id list -> Ast_util.untyped_def list
val undefined_builtin_val_specs : Ast_util.untyped_def list

Val specs of undefined functions for builtin types that get added to the AST by generate_undefinds (minus those functions that already exist in the AST).

val generate_undefineds : Ast_util.IdSet.t -> Ast_util.untyped_def list
val generate_initialize_registers : Ast_util.IdSet.t -> (Ast.id * Ast.typ) list -> Ast_util.untyped_def list
val generate_enum_number_conversions : Ast_util.untyped_def list -> Ast_util.untyped_def list
val process_ast : ctx -> Parse_ast.defs -> Ast_util.untyped_ast * ctx

Parsing expressions and definitions from strings

val extern_of_string : ?pure:bool -> Ast.id -> string -> Ast_util.untyped_def
val val_spec_of_string : Ast.id -> string -> Ast_util.untyped_def
val defs_of_string : (string * int * int * int) -> ctx -> string -> Ast_util.untyped_def list * ctx
val ast_of_def_string : ?inline:Lexing.position -> (string * int * int * int) -> ctx -> string -> Ast_util.untyped_ast * ctx
val ast_of_def_string_with : ?inline:Lexing.position -> (string * int * int * int) -> ctx -> (Parse_ast.def list -> Parse_ast.def list) -> string -> Ast_util.untyped_ast * ctx
val exp_of_string : ?inline:Lexing.position -> string -> Ast_util.uannot Ast.exp
val typ_of_string : ?inline:Lexing.position -> string -> Ast.typ
val constraint_of_string : ?inline:Lexing.position -> string -> Ast.n_constraint

Parsing files

val parse_file : ?loc:Parse_ast.l -> string -> Lexer.comment list * Parse_ast.def list

Parse a file into a sequence of comments and a parse AST

  • parameter ?loc

    If we get an error reading the file, report the error at this location

val get_lexbuf_from_string : filename:string -> contents:string -> Lexing.lexbuf
val parse_file_from_string : filename:string -> contents:string -> Lexer.comment list * Parse_ast.def list
val parse_project : ?inline:Lexing.position -> ?filename:string -> contents:string -> unit -> Project.def Project.spanned list
OCaml

Innovation. Community. Security.