Module Compiler_util

module Compiler_util: sig .. end
Support code for writing a simple compiler.

type id = string 
val pp_id : Format.formatter -> id -> Ppx_deriving_runtime.unit
val show_id : id -> Ppx_deriving_runtime.string
type op2 = 
| LT
| GT
| Eq
| Add
| Sub
| Mul
| Div
| Mod
val pp_op2 : Format.formatter -> op2 -> Ppx_deriving_runtime.unit
val show_op2 : op2 -> Ppx_deriving_runtime.string
type const = 
| Int of int
| Bool of bool
val pp_const : Format.formatter -> const -> Ppx_deriving_runtime.unit
val show_const : const -> Ppx_deriving_runtime.string
type exp = 
| Id of id
| Const of const
| Op2 of op2 * exp * exp
| If of exp * exp * exp
| Let of id * exp * exp
| Fun of id * id list * exp
| App of exp * exp list
| MkArray of exp * exp
| GetArray of exp * exp
| SetArray of exp * exp * exp
| Seq of exp * exp
val pp_exp : Format.formatter -> exp -> Ppx_deriving_runtime.unit
val show_exp : exp -> Ppx_deriving_runtime.string
val from_string : string -> exp
val from_file : string -> exp
type aexp = 
| AId of id
| AConst of const
Atomic expressions.
type bexp = 
| BFun of id * id list * anfexp
| BAtom of aexp
| BOp2 of op2 * aexp * aexp
| BMkArray of aexp * aexp
| BGetArray of aexp * aexp
| BSetArray of aexp * aexp * aexp
| BApp of aexp * aexp list
Binding forms.
type anfexp = 
| ELet of id * bexp * anfexp
| EIf of aexp * anfexp * anfexp
| EApp of aexp * aexp list
| ERet of aexp
Expressions in A-normal form.
val pp_aexp : Format.formatter -> aexp -> Ppx_deriving_runtime.unit
val show_aexp : aexp -> Ppx_deriving_runtime.string
val pp_bexp : Format.formatter -> bexp -> Ppx_deriving_runtime.unit
val show_bexp : bexp -> Ppx_deriving_runtime.string
val pp_anfexp : Format.formatter -> anfexp -> Ppx_deriving_runtime.unit
val show_anfexp : anfexp -> Ppx_deriving_runtime.string
module IdSet: Set.S  with type elt = id
val free_vars : anfexp -> IdSet.t
val rename : id ->
id -> anfexp -> anfexp