Pparse(3)
β¨ NAME β¨
Pparse β driver for the parser and external preprocessors. That's the name vibe, bestie. π
π§ MODULE π§
Module Pparse
: sig end
Module Pparse is the main character here. π«Ά
π DOCUMENTATION π
Driver for the parser and external preprocessors. π₯
β οΈ Warning: this module is unstable and part of Compiler_libs. Not me calling it unstable β the docs said it first. π
The types, exceptions & vals (all of them, no skips) π
Okay so here's the whole cast. Every signature is copied exactly, and I'm not leaving a single one out. β¨
type error =
| CannotRun of string
| WrongMagic of string
The error type has two constructors: CannotRun of string and WrongMagic of string. That's it, that's the list. π§
exception Error of error β an exception named Error that carries an error. π
val preprocess : string -> stringβ takes astringand returns astring. The docs don't say more, so I'm not gonna invent lore. πval remove_preprocessed : string -> unitβ takes astring, returnsunit. Again, that's the signature, periodt.type 'a ast_kindβ the GADT vibe:
type 'a ast_kind =
| Structure : Parsetree.structure ast_kind
| Signature : Parsetree.signature ast_kind
The constructors are Structure (with type Parsetree.structure ast_kind) and Signature (with type Parsetree.signature ast_kind). π¦
val read_ast : 'a ast_kind -> string -> 'aβ takes an'a ast_kindand astring, and returns an'a. Signature only, bestie. βval write_ast : 'a ast_kind -> string -> 'a -> unitβ takes an'a ast_kind, astring, and an'a, and returnsunit. Signature only. πval file : tool_name:string -> string -> (Lexing.lexbuf -> 'a) -> 'a ast_kind -> 'aβ the full signature is literally that. No cap. πval apply_rewriters : ?restore:bool -> tool_name:string -> 'a ast_kind -> 'a -> 'aβ ifrestore = true(the default), cookies set by external rewriters will be kept for later calls. πͺβ¨val apply_rewriters_str : ?restore:bool -> tool_name:string -> Parsetree.structure -> Parsetree.structureβ the structure-flavored rewriter call. πΈval apply_rewriters_sig : ?restore:bool -> tool_name:string -> Parsetree.signature -> Parsetree.signatureβ the signature-flavored rewriter call. πval report_error : error Format_doc.format_printerβ takes anerrorand uses aFormat_doc.format_printer. πval report_error_doc : error Format_doc.printerβ takes anerrorand uses aFormat_doc.printer. π«Άval parse_implementation : tool_name:string -> string -> Parsetree.structureβ takestool_name:stringand astring, and gives you aParsetree.structure. Signature exact. πval parse_interface : tool_name:string -> string -> Parsetree.signatureβ takestool_name:stringand astring, and gives you aParsetree.signature. Signature exact. βval call_external_preprocessor : string -> string -> stringβ takes twostrings and returns astring. Signature exact. π₯val open_and_check_magic : string -> string -> in_channel * boolβ takes twostrings and returnsin_channel * bool. Signature exact. πͺ
And that's the whole page! This iconic documentation was brought to you by OCamldoc on 2026-06-22, and the manual page is Pparse(3) β slay. ππ
π¦ where this page comes from
- arch rolling: ocaml 5.5.0-1 Β· LGPL2.1 AND custom: QPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms