package links

  1. Overview
  2. Docs

Intermediate language

module Var : sig ... end
module Label : sig ... end
type t =
  1. | Var of Var.t
    (*

    Var denotes a variable, e.g. x, foo, etc

    *)
  2. | Lit of string
    (*

    Lit denotes an boolean, float, integer, or string literal, e.g. true, 3.14, 42, "Hello World!"

    *)
  3. | Fn of Var.t list * t
    (*

    Fn denotes an anonymous function, e.g. function(x) return x; . The first component Var.t list is the formal parameter list and the second component t is the body.

    *)
  4. | 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, and Ir.location is the function location (client, server, or unknown). The second component t is the continuation of the function binding.

    *)
  5. | 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; . A LetRec is essentially a list of LetFuns.

    *)
  6. | Call of t * t list
    (*

    Call denotes a function call, e.g. f(1,"foo"); where t is the function expression (abstractor) and t list is the argument list.

    *)
  7. | Unop of Var.t * t
    (*

    Unop denotes a unary expression, e.g. !true; where Var.t is the name of the unary operator applied to the expression t.

    *)
  8. | Binop of t * Var.t * t
    (*

    Binop denotes an infix binary operator expression, e.g. 2 + 40. The first t is the left hand side of the binary operator, Var.t is the name of the operator, and the second t is the right hand side of the operator.

    *)
  9. | If of t * t * t
    (*

    If denotes a conditional statement, e.g. if (cond) print("true"); else print("false") where the first t is the condition-expression, the second t is the then-branch/true-branch statement, and the third t is the else-branch/false-branch statement.

    *)
  10. | 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(); where t is the scrutinee-expression, t stringmap is a mapping from string literals to statements, i.e. case statements, and t option is the default statement.

    *)
  11. | 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.

    *)
  12. | Arr of t list
    (*

    Arr denotes an array, e.g. 1,2,3,4,5. The t list is the elements of the array.

    *)
  13. | Project of t * Label.t
    (*

    Project denotes a component selection, e.g. obj.baz, obj1 where t is an expression and Label.t is the name of component being selected.

    *)
  14. | Bind of Var.t * t * t
    (*

    Bind denotes a variable binding, e.g. let x = 42; let y = true; doSomething(x, y) where Var.t is the name of the variable, the first t is the expression/value being bound, and the second t is the continuation of the binding.

    *)
  15. | Return of t
    (*

    Return denotes a return statement, e.g. return 42; where t is an expression.

    *)
  16. | 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.

    *)
  17. | 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
module MetaContinuation : sig ... end
OCaml

Innovation. Community. Security.