Skip to content

Instantly share code, notes, and snippets.

@Gbury

Gbury/cps.ml Secret

Created June 4, 2021 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gbury/7a02a35cb4906914fa351183490f11b2 to your computer and use it in GitHub Desktop.
Save Gbury/7a02a35cb4906914fa351183490f11b2 to your computer and use it in GitHub Desktop.
type var = int
type symbol = string
type continuation = int
type simple =
| Var of var
| Symbol of symbol
type primitive =
| Add_int
| Add_float
type named =
| Simple of simple
| Primitive of primitive * simple list
| Set_of_closures of set_of_closures
type expr =
| Let_expr of { var : var; defining_expr : named; body : expr; }
| Let_cont of { cont : continuation; handler : var list * expr; body : expr; }
| Apply_expr of { callee : simple; args : simple list; return_cont : continuation; exn_cont : continuation; }
| Apply_cont of apply_cont
| Switch of { scrutinee : simple; arms : (int * apply_cont) list; }
and apply_cont = {
cont: continuation;
args : simple list;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment