ppx_nanocaml

Framework for writing nanopass-style compilers
IN THIS PACKAGE
Module Nanocaml . Ast
include module type of struct include Migrate_parsetree.Ast_405 end
module Location = Location
module Longident = Longident
module Asttypes : sig ... end

Auxiliary AST types used by parsetree and typedtree.

module Parsetree : sig ... end

Abstract syntax tree produced by parsing

module Docstrings : sig ... end
module Ast_helper : sig ... end

Helpers to produce Parsetree fragments

module Ast_mapper : sig ... end

The interface of a -ppx rewriter

module Outcometree : sig ... end
module Config : sig ... end
val shallow_identity : Ast_mapper.mapper
val failing_mapper : Ast_mapper.mapper
val make_top_mapper : signature:( Parsetree.signature -> Parsetree.signature ) -> structure:( Parsetree.structure -> Parsetree.structure ) -> Ast_mapper.mapper
include module type of struct include Migrate_parsetree.Ast_405.Parsetree end
type constant =
| Pconst_integer of string * char option
| Pconst_char of char
| Pconst_string of string * string option
| Pconst_float of string * char option

Extension points

and attributes = attribute list
and payload =
| PStr of structure
| PSig of signature
| PTyp of core_type
| PPat of pattern * expression option

Core language

and core_type = {
ptyp_desc : core_type_desc;
ptyp_loc : Migrate_parsetree.Ast_405.Location.t;
ptyp_attributes : attributes;
}
and row_field =
| Rtag of Migrate_parsetree.Ast_405.Asttypes.label * attributes * bool * core_type list
| Rinherit of core_type
and pattern = {
ppat_desc : pattern_desc;
ppat_loc : Migrate_parsetree.Ast_405.Location.t;
ppat_attributes : attributes;
}
and expression = {
pexp_desc : expression_desc;
pexp_loc : Migrate_parsetree.Ast_405.Location.t;
pexp_attributes : attributes;
}
and expression_desc =
| Pexp_ident of Migrate_parsetree.Ast_405.Longident.t Migrate_parsetree.Ast_405.Asttypes.loc
| Pexp_constant of constant
| Pexp_let of Migrate_parsetree.Ast_405.Asttypes.rec_flag * value_binding list * expression
| Pexp_function of case list
| Pexp_fun of Migrate_parsetree.Ast_405.Asttypes.arg_label * expression option * pattern * expression
| Pexp_apply of expression * (Migrate_parsetree.Ast_405.Asttypes.arg_label * expression) list
| Pexp_match of expression * case list
| Pexp_try of expression * case list
| Pexp_tuple of expression list
| Pexp_construct of Migrate_parsetree.Ast_405.Longident.t Migrate_parsetree.Ast_405.Asttypes.loc * expression option
| Pexp_variant of Migrate_parsetree.Ast_405.Asttypes.label * expression option
| Pexp_record of (Migrate_parsetree.Ast_405.Longident.t Migrate_parsetree.Ast_405.Asttypes.loc * expression) list * expression option
| Pexp_field of expression * Migrate_parsetree.Ast_405.Longident.t Migrate_parsetree.Ast_405.Asttypes.loc
| Pexp_setfield of expression * Migrate_parsetree.Ast_405.Longident.t Migrate_parsetree.Ast_405.Asttypes.loc * expression
| Pexp_array of expression list
| Pexp_ifthenelse of expression * expression * expression option
| Pexp_sequence of expression * expression
| Pexp_while of expression * expression
| Pexp_for of pattern * expression * expression * Migrate_parsetree.Ast_405.Asttypes.direction_flag * expression
| Pexp_constraint of expression * core_type
| Pexp_coerce of expression * core_type option * core_type
| Pexp_send of expression * string Migrate_parsetree.Ast_405.Asttypes.loc
| Pexp_new of Migrate_parsetree.Ast_405.Longident.t Migrate_parsetree.Ast_405.Asttypes.loc
| Pexp_setinstvar of string Migrate_parsetree.Ast_405.Asttypes.loc * expression
| Pexp_override of (string Migrate_parsetree.Ast_405.Asttypes.loc * expression) list
| Pexp_letmodule of string Migrate_parsetree.Ast_405.Asttypes.loc * module_expr * expression
| Pexp_letexception of extension_constructor * expression
| Pexp_assert of expression
| Pexp_lazy of expression
| Pexp_poly of expression * core_type option
| Pexp_object of class_structure
| Pexp_newtype of string Migrate_parsetree.Ast_405.Asttypes.loc * expression
| Pexp_pack of module_expr
| Pexp_open of Migrate_parsetree.Ast_405.Asttypes.override_flag * Migrate_parsetree.Ast_405.Longident.t Migrate_parsetree.Ast_405.Asttypes.loc * expression
| Pexp_extension of extension
| Pexp_unreachable
and case = {
pc_lhs : pattern;
pc_guard : expression option;
pc_rhs : expression;
}
and value_description = {
pval_name : string Migrate_parsetree.Ast_405.Asttypes.loc;
pval_type : core_type;
pval_prim : string list;
pval_attributes : attributes;
pval_loc : Migrate_parsetree.Ast_405.Location.t;
}
and type_declaration = {
ptype_name : string Migrate_parsetree.Ast_405.Asttypes.loc;
ptype_params : (core_type * Migrate_parsetree.Ast_405.Asttypes.variance) list;
ptype_cstrs : (core_type * core_type * Migrate_parsetree.Ast_405.Location.t) list;
ptype_kind : type_kind;
ptype_private : Migrate_parsetree.Ast_405.Asttypes.private_flag;
ptype_manifest : core_type option;
ptype_attributes : attributes;
ptype_loc : Migrate_parsetree.Ast_405.Location.t;
}
and type_kind =
| Ptype_abstract
| Ptype_variant of constructor_declaration list
| Ptype_record of label_declaration list
| Ptype_open
and label_declaration = {
pld_name : string Migrate_parsetree.Ast_405.Asttypes.loc;
pld_mutable : Migrate_parsetree.Ast_405.Asttypes.mutable_flag;
pld_type : core_type;
pld_loc : Migrate_parsetree.Ast_405.Location.t;
pld_attributes : attributes;
}
and constructor_declaration = {
pcd_name : string Migrate_parsetree.Ast_405.Asttypes.loc;
pcd_args : constructor_arguments;
pcd_res : core_type option;
pcd_loc : Migrate_parsetree.Ast_405.Location.t;
pcd_attributes : attributes;
}
and constructor_arguments =
| Pcstr_tuple of core_type list
| Pcstr_record of label_declaration list
and extension_constructor = {
pext_name : string Migrate_parsetree.Ast_405.Asttypes.loc;
pext_kind : extension_constructor_kind;
pext_loc : Migrate_parsetree.Ast_405.Location.t;
pext_attributes : attributes;
}
and extension_constructor_kind =
| Pext_decl of constructor_arguments * core_type option
| Pext_rebind of Migrate_parsetree.Ast_405.Longident.t Migrate_parsetree.Ast_405.Asttypes.loc

Class language

and class_type = {
pcty_desc : class_type_desc;
pcty_loc : Migrate_parsetree.Ast_405.Location.t;
pcty_attributes : attributes;
}
and class_signature = {
pcsig_self : core_type;
pcsig_fields : class_type_field list;
}
and class_type_field = {
pctf_desc : class_type_field_desc;
pctf_loc : Migrate_parsetree.Ast_405.Location.t;
pctf_attributes : attributes;
}
and class_description = class_type class_infos
and class_type_declaration = class_type class_infos
and class_expr = {
pcl_desc : class_expr_desc;
pcl_loc : Migrate_parsetree.Ast_405.Location.t;
pcl_attributes : attributes;
}
and class_structure = {
pcstr_self : pattern;
pcstr_fields : class_field list;
}
and class_field = {
pcf_desc : class_field_desc;
pcf_loc : Migrate_parsetree.Ast_405.Location.t;
pcf_attributes : attributes;
}
and class_field_kind =
| Cfk_virtual of core_type
| Cfk_concrete of Migrate_parsetree.Ast_405.Asttypes.override_flag * expression
and class_declaration = class_expr class_infos

Module language

and module_type = {
pmty_desc : module_type_desc;
pmty_loc : Migrate_parsetree.Ast_405.Location.t;
pmty_attributes : attributes;
}
and signature = signature_item list
and signature_item = {
psig_desc : signature_item_desc;
psig_loc : Migrate_parsetree.Ast_405.Location.t;
}
and signature_item_desc =
| Psig_value of value_description
| Psig_type of Migrate_parsetree.Ast_405.Asttypes.rec_flag * type_declaration list
| Psig_typext of type_extension
| Psig_exception of extension_constructor
| Psig_module of module_declaration
| Psig_recmodule of module_declaration list
| Psig_modtype of module_type_declaration
| Psig_open of open_description
| Psig_include of include_description
| Psig_class of class_description list
| Psig_class_type of class_type_declaration list
| Psig_attribute of attribute
| Psig_extension of extension * attributes
and module_declaration = {
pmd_name : string Migrate_parsetree.Ast_405.Asttypes.loc;
pmd_type : module_type;
pmd_attributes : attributes;
pmd_loc : Migrate_parsetree.Ast_405.Location.t;
}
and module_type_declaration = {
pmtd_name : string Migrate_parsetree.Ast_405.Asttypes.loc;
pmtd_type : module_type option;
pmtd_attributes : attributes;
pmtd_loc : Migrate_parsetree.Ast_405.Location.t;
}
and 'a include_infos = {
pincl_mod : 'a;
pincl_loc : Migrate_parsetree.Ast_405.Location.t;
pincl_attributes : attributes;
}
and include_description = module_type include_infos
and include_declaration = module_expr include_infos
and module_expr = {
pmod_desc : module_expr_desc;
pmod_loc : Migrate_parsetree.Ast_405.Location.t;
pmod_attributes : attributes;
}
and module_expr_desc =
| Pmod_ident of Migrate_parsetree.Ast_405.Longident.t Migrate_parsetree.Ast_405.Asttypes.loc
| Pmod_structure of structure
| Pmod_functor of string Migrate_parsetree.Ast_405.Asttypes.loc * module_type option * module_expr
| Pmod_apply of module_expr * module_expr
| Pmod_constraint of module_expr * module_type
| Pmod_unpack of expression
| Pmod_extension of extension
and structure = structure_item list
and structure_item = {
pstr_desc : structure_item_desc;
pstr_loc : Migrate_parsetree.Ast_405.Location.t;
}
and structure_item_desc =
| Pstr_eval of expression * attributes
| Pstr_value of Migrate_parsetree.Ast_405.Asttypes.rec_flag * value_binding list
| Pstr_primitive of value_description
| Pstr_type of Migrate_parsetree.Ast_405.Asttypes.rec_flag * type_declaration list
| Pstr_typext of type_extension
| Pstr_exception of extension_constructor
| Pstr_module of module_binding
| Pstr_recmodule of module_binding list
| Pstr_modtype of module_type_declaration
| Pstr_open of open_description
| Pstr_class of class_declaration list
| Pstr_class_type of class_type_declaration list
| Pstr_include of include_declaration
| Pstr_attribute of attribute
| Pstr_extension of extension * attributes
and value_binding = {
pvb_pat : pattern;
pvb_expr : expression;
pvb_attributes : attributes;
pvb_loc : Migrate_parsetree.Ast_405.Location.t;
}
and module_binding = {
pmb_name : string Migrate_parsetree.Ast_405.Asttypes.loc;
pmb_expr : module_expr;
pmb_attributes : attributes;
pmb_loc : Migrate_parsetree.Ast_405.Location.t;
}

Toplevel

type toplevel_phrase =
| Ptop_def of structure
| Ptop_dir of string * directive_argument
and directive_argument =
| Pdir_none
| Pdir_string of string
| Pdir_int of string * char option
| Pdir_ident of Migrate_parsetree.Ast_405.Longident.t
| Pdir_bool of bool