package links
Intermediate language
module Var : sig ... end
module Label : sig ... end
type t =
| Var of Var.t
(*
*)Var
denotes a variable, e.g. x, foo, etc| Lit of string
(*
*)Lit
denotes an boolean, float, integer, or string literal, e.g. true, 3.14, 42, "Hello World!"| Fn of Var.t list * t
(*
*)Fn
denotes an anonymous function, e.g. function(x)return x;
. The first componentVar.t list
is the formal parameter list and the second componentt
is the body.| LetFun of Var.t * Var.t list * t * Ir.location * t
(*
*)LetFun
denotes a named function, e.g. function add(x, y)return x + y;
. The first component is a quadruple where:Var.t
is the name of the function,Var.t list
is the formal parameter list,t
is the body, andIr.location
is the function location (client, server, or unknown). The second componentt
is the continuation of the function binding.| LetRec of (Var.t * Var.t list * t * Ir.location) list * t
(*
*)LetRec
denotes a group of named mutually recursive functions, e.g. function fac(n)if (n === 0) return fac0(); else return n * fac(n-1)
function fac0()return 0;
. ALetRec
is essentially a list ofLetFun
s.| Call of t * t list
(*
*)Call
denotes a function call, e.g. f(1,"foo"); wheret
is the function expression (abstractor) andt list
is the argument list.| Unop of Var.t * t
(*
*)Unop
denotes a unary expression, e.g. !true; whereVar.t
is the name of the unary operator applied to the expressiont
.| Binop of t * Var.t * t
(*
*)Binop
denotes an infix binary operator expression, e.g. 2 + 40. The firstt
is the left hand side of the binary operator,Var.t
is the name of the operator, and the secondt
is the right hand side of the operator.| If of t * t * t
(*
*)If
denotes a conditional statement, e.g. if (cond) print("true"); else print("false") where the firstt
is the condition-expression, the secondt
is the then-branch/true-branch statement, and the thirdt
is the else-branch/false-branch statement.| Switch of t * t Utility.stringmap * t option
(*
*)Switch
denotes a switch statement, e.g. switch(s)case "Foo": doSomething(); break; case "Bar": doSomethingElse(); break; default: otherwiseDoThis();
wheret
is the scrutinee-expression,t stringmap
is a mapping from string literals to statements, i.e. case statements, andt option
is the default statement.| Dict of (Label.t * t) list
(*
*)Dict
denotes a literal object in JSON, e.g.'foo': 42, 'bar': false
where(Label.t * t) list
is an association list/mapping from string literals to expressions.| Arr of t list
(*
*)Arr
denotes an array, e.g.1,2,3,4,5
. Thet list
is the elements of the array.| Project of t * Label.t
(*
*)Project
denotes a component selection, e.g. obj.baz, obj1
wheret
is an expression andLabel.t
is the name of component being selected.| Bind of Var.t * t * t
(*
*)Bind
denotes a variable binding, e.g. let x = 42; let y = true; doSomething(x, y) whereVar.t
is the name of the variable, the firstt
is the expression/value being bound, and the secondt
is the continuation of the binding.| Return of t
(*
*)Return
denotes a return statement, e.g. return 42; wheret
is an expression.| InlineJS of string
(*
*)InlineJS
is a convenience mechanism for inlining handcrafted JavaScript into generated JavaScript code. Don't use otherwise you know what you are doing -- and even then, don't use it.| Nothing
(*
*)Nothing
denotes the empty code. It can be used to end a binding sequence whose continuation is empty.
val pp :
Ppx_deriving_runtime.Format.formatter ->
t ->
Ppx_deriving_runtime.unit
val show : t -> Ppx_deriving_runtime.string
module MetaContinuation : sig ... end