Parser(3)
π NAME π
okay so bestie, this is the manual page for Parser(3) from the OCaml library β manual name folded in right here so we can get straight to the tea. The source literally says no description, which is giving mysterious main character energy, but don't worry: the rest of the page is right below and it has everything. π
π Module π
Module Parser
β¨ Documentation β¨
π§ Module Parser π§
The module is declared as Module Parser : sig end. Short, sweet, and very βI contain multitudes but my signature is a little mysterious.β π«Ά
π¦ The token type π¦
Hereβs the full token guest list β every single constructor, no cap, nothing skipped:
type token =
| WITH
| WHILE
| WHEN
| VIRTUAL
| VAL
| UNDERSCORE
| UIDENT of string
| TYPE
| TRY
| TRUE
| TO
| TILDE
| THEN
| STRUCT
| STRING of (string * Location.t * string option)
| STAR
| SIG
| SEMISEMI
| SEMI
| RPAREN
| REC
| RBRACKET
| RBRACE
| QUOTED_STRING_ITEM of (string * Location.t * string * Location.t *
string option)
| QUOTED_STRING_EXPR of (string * Location.t * string * Location.t *
string option)
| QUOTE
| QUESTION
| PRIVATE
| PREFIXOP of string
| PLUSEQ
| PLUSDOT
| PLUS
| PERCENT
| OR
| OPTLABEL of string
| OPEN
| OF
| OBJECT
| NONREC
| NEW
| MUTABLE
| MODULE
| MINUSGREATER
| MINUSDOT
| MINUS
| METHOD
| METAOCAML_ESCAPE
| METAOCAML_BRACKET_OPEN
| METAOCAML_BRACKET_CLOSE
| MATCH
| LPAREN
| LIDENT of string
| LETOP of string
| LET
| LESSMINUS
| LESS
| LBRACKETPERCENTPERCENT
| LBRACKETPERCENT
| LBRACKETLESS
| LBRACKETGREATER
| LBRACKETBAR
| LBRACKETATATAT
| LBRACKETATAT
| LBRACKETAT
| LBRACKET
| LBRACELESS
| LBRACE
| LAZY
| LABEL of string
| INT of (string * char option)
| INITIALIZER
| INHERIT
| INFIXOP4 of string
| INFIXOP3 of string
| INFIXOP2 of string
| INFIXOP1 of string
| INFIXOP0 of string
| INCLUDE
| IN
| IF
| HASHOP of string
| HASH
| GREATERRBRACKET
| GREATERRBRACE
| GREATER
| FUNCTOR
| FUNCTION
| FUN
| FOR
| FLOAT of (string * char option)
| FALSE
| EXTERNAL
| EXCEPTION
| EQUAL
| EOL
| EOF
| END
| ELSE
| EFFECT
| DOWNTO
| DOTOP of string
| DOTDOT
| DOT
| DONE
| DOCSTRING of Docstrings.docstring
| DO
| CONSTRAINT
| COMMENT of (string * Location.t)
| COMMA
| COLONGREATER
| COLONEQUAL
| COLONCOLON
| COLON
| CLASS
| CHAR of char
| BEGIN
| BARRBRACKET
| BARBAR
| BAR
| BANG
| BACKQUOTE
| ASSERT
| AS
| ANDOP of string
| AND
| AMPERSAND
| AMPERAMPER
π exception Error π
Yep, there is an exception, and it is exactly exception Error. The source gives us no extra lore, no dramatic backstory, just the exception itself. Respect. π
πΈ Parser functions πΈ
Every one of these takes a lexer function of type (Lexing.lexbuf -> token) plus a Lexing.lexbuf. Here they all are, with their exact return types:
use_fileβ gives you back aParsetree.toplevel_phrase list. Signature:val use_file : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Parsetree.toplevel_phrase listtoplevel_phraseβ gives you back a singleParsetree.toplevel_phrase. Signature:val toplevel_phrase : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Parsetree.toplevel_phraseparse_val_longidentβ gives you back aLongident.t. Signature:val parse_val_longident : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Longident.tparse_patternβ gives you back aParsetree.pattern. Signature:val parse_pattern : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Parsetree.patternparse_mty_longidentβ gives you back aLongident.t. Signature:val parse_mty_longident : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Longident.tparse_module_typeβ gives you back aParsetree.module_type. Signature:val parse_module_type : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Parsetree.module_typeparse_module_exprβ gives you back aParsetree.module_expr. Signature:val parse_module_expr : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Parsetree.module_exprparse_mod_longidentβ gives you back aLongident.t. Signature:val parse_mod_longident : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Longident.tparse_mod_ext_longidentβ gives you back aLongident.t. Signature:val parse_mod_ext_longident : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Longident.tparse_expressionβ gives you back aParsetree.expression. Signature:val parse_expression : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Parsetree.expressionparse_core_typeβ gives you back aParsetree.core_type. Signature:val parse_core_type : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Parsetree.core_typeparse_constr_longidentβ gives you back aLongident.t. Signature:val parse_constr_longident : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Longident.tparse_any_longidentβ gives you back aLongident.t. Signature:val parse_any_longident : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Longident.tinterfaceβ gives you back aParsetree.signature. Signature:val interface : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Parsetree.signatureimplementationβ gives you back aParsetree.structure. Signature:val implementation : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> Parsetree.structure
π Modules π
MenhirInterpreterβmodule MenhirInterpreter : sig endIncrementalβmodule Incremental : sig end
and thatβs literally the whole page, bestie β every token, every signature, every tiny sig end accounted for. πβ¨
Signed off by OCamldoc, dated 2026-06-22, and this is Parser(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