Pparse(3) OCaml library Pparse(3)

# [NAME](#NAME)

Pparse - Driver for the parser and external preprocessors.

# [Module](#Module)

Module Pparse

# [Documentation](#Documentation)

Module **Pparse**  
: **sig end**

Driver for the parser and external preprocessors.

Warning: this module is unstable and part of **Compiler\_libs** .

*type error* =  
| CannotRun **of** **string**  
| WrongMagic **of** **string**

*exception Error* **of** **error**

*val preprocess* : **string -&gt; string**

*val remove\_preprocessed* : **string -&gt; unit**

*type* **'a** *ast\_kind* =  
| Structure **:** **Parsetree.structure ast\_kind**  
| Signature **:** **Parsetree.signature ast\_kind**

*val read\_ast* : **'a ast\_kind -&gt; string -&gt; 'a**

*val write\_ast* : **'a ast\_kind -&gt; string -&gt; 'a -&gt; unit**

*val file* : **tool\_name:string -&gt;** **string -&gt; (Lexing.lexbuf -&gt; 'a) -&gt; 'a ast\_kind -&gt; 'a**

*val apply\_rewriters* : **?restore:bool -&gt; tool\_name:string -&gt; 'a ast\_kind -&gt; 'a -&gt; 'a**

If **restore = true** (the default), cookies set by external rewriters will be kept for later calls.

*val apply\_rewriters\_str* : **?restore:bool -&gt;** **tool\_name:string -&gt; Parsetree.structure -&gt; Parsetree.structure**

*val apply\_rewriters\_sig* : **?restore:bool -&gt;** **tool\_name:string -&gt; Parsetree.signature -&gt; Parsetree.signature**

*val report\_error* : **error Format\_doc.format\_printer**

*val report\_error\_doc* : **error Format\_doc.printer**

*val parse\_implementation* : **tool\_name:string -&gt; string -&gt; Parsetree.structure**

*val parse\_interface* : **tool\_name:string -&gt; string -&gt; Parsetree.signature**

*val call\_external\_preprocessor* : **string -&gt; string -&gt; string**

*val open\_and\_check\_magic* : **string -&gt; string -&gt; in\_channel * bool**

2026-10-01 OCamldoc

---

Document: Pparse(3o) from ocaml 5.5.1-r1 (Chainguard OS)
Source: https://github.com/ocaml/ocaml
