package ppx_nanocaml
module A = Nanocaml.Ast.Ast_helper
module Enum : sig ... end
val lident_of_id :
string Pass.loc ->
Nanocaml.Ast.Longident.t Nanocaml.Ast.Location.loc
convert string loc
into Longident.t loc
as just a Lident
. *
val exp_of_id :
string Pass.loc ->
Migrate_parsetree__Ast_405.Parsetree.expression
convert string loc
into expr
that is just a Pexp_ident
. *
val simple_let :
?recflag:Nanocaml.Ast.Asttypes.rec_flag ->
string Nanocaml.Ast.Asttypes.loc ->
Migrate_parsetree__Ast_405.Parsetree.expression ->
Migrate_parsetree__Ast_405.Parsetree.expression ->
Migrate_parsetree__Ast_405.Parsetree.expression
generates simple let x = e1 in e2
expression *
val simple_pat_let :
?recflag:Nanocaml.Ast.Asttypes.rec_flag ->
Ast.pattern ->
Migrate_parsetree__Ast_405.Parsetree.expression ->
Migrate_parsetree__Ast_405.Parsetree.expression ->
Migrate_parsetree__Ast_405.Parsetree.expression
generates simple let p = e1 in e2
expression *
val fresh : next_id:int Batteries.ref -> loc:Location.t -> string Pass.loc
generate fresh string loc
using the given int ref
.
val vars_of_pattern : Pass.np_pat -> string Pass.loc list
finds all the variables mentioned in the given pattern. returns the string loc
s in reverse order.
module Lib_ast : sig ... end
val gen_simple_pat :
Pass.np_pat ->
Migrate_parsetree__Ast_405.Parsetree.pattern
given an unconditional pattern, converts it to an equivalent parsetree pattern.
val gen_pattern :
next_id:int Batteries.ref ->
bind_as:string Location.loc option ->
Pass.np_pat ->
Migrate_parsetree__Ast_405.Parsetree.pattern
* (Migrate_parsetree__Ast_405.Parsetree.expression ->
Migrate_parsetree__Ast_405.Parsetree.expression)
given an np_pat
, returns ppat, intro
, where ppat
is the generated pattern, and intro
is a function on expressions which introduces let bindings around the given expression. TODO: maybe represent intro
as a list of value bindings instead of a function?
~next_id
is a ref int
used to generate fresh identifies if ~bind_as
is Some <string loc>
, the given string will be bound to the result of the pattern.
val gen_l_lhs : loc:Nanocaml.Ast.Location.t -> Pass.np_pat -> Ast.pattern
generate the LHS pattern for a @l
pattern (for binding the results of the list comprehension).
val gen_l_rhs :
next_id:int Batteries.ref ->
Pass.np_pat ->
string Pass.loc ->
Migrate_parsetree__Ast_405.Parsetree.expression
generate the RHS expression for a @l
pattern (the expression that performs the list comprehension).
val typ_of_nonterm :
loc:Location.t ->
Lang.np_language ->
Lang.np_nonterm ->
Migrate_parsetree__Ast_405.Parsetree.core_type
generate type expression from language and nonterm *
val gen_zipper_exps :
next_id:int Batteries.ref ->
loc:'a ->
Migrate_parsetree__Ast_405.Parsetree.expression ->
Migrate_parsetree__Ast_405.Parsetree.expression
val gen_processor_vb :
Lang.np_language ->
Lang.np_language ->
Pass.np_processor ->
Migrate_parsetree__Ast_405.Parsetree.value_binding
generate value_binding
from np_processor
. *
val gen_pass_vb :
Pass.np_pass ->
Migrate_parsetree__Ast_405.Parsetree.value_binding
generate value_binding
from np_pass
. *