From f1aa8b324eddd960d79f30131ef2f72dc741b655 Mon Sep 17 00:00:00 2001 From: nisstyre56 Date: Sun, 2 Mar 2014 00:00:38 -0500 Subject: [PATCH] closure conversion, expanded description more --- closure_conversion.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/closure_conversion.js b/closure_conversion.js index 5dff49c..bcd45cd 100644 --- a/closure_conversion.js +++ b/closure_conversion.js @@ -1,5 +1,8 @@ /* Takes an AST and converts all of the functions into closures. - * A closure is a pair of two things: an environment and a function + * A closure is a triple of: + * a mapping from names to expressions + * a mapping from names to type expressions + * a function (which includes the formal parameters and the body) * The closure has the property that all of the free variables of the function * are in the environment, or an exception is raised because the variable is not bound * in the current environment. @@ -15,3 +18,8 @@ * For the purposes of type checking it does not matter how the function gets called, the environment * is only used for looking up the types of names. Formal parameters are given type variables. */ + +var rep = require("./representation.js"); +var env = require("./environments.js"); + +function convert