Tue May 4 19:26:08 EDT 2010
Assignments + applications are primitive procedures
It seems that separating node allocation (declaration) and procedure
invocation is the essential idea: this frees up outputs for allocation
by the caller.
Again, look at Oz. This way, functions+assignments are primitive
procedures. Here ``procedure'' refers to the CTM approach of
building functions on top of procedures that allow single assignment.
Such a structure (procedure instead of function based) translates
directly to C/LLVM code with input/output and state vectors.
Compiling between Term (+ possibly recovered sharing) and Procedure is
the main problem to solve.
Term ---> Shared ---> Procedure
-- Node Names
type Input = String
type Output = String
type Temp = String
-- Procedure Abstraction
data PAbs = PAbs [Input] [Output] [Temp] [PApp]
-- Procedure application
data PApp = PApp Proc [Input] [Output]
data Proc = PComp PAbs
| PPrim String
This seems to be OK. It composes (it's a recursive type terminated by
the PComp | PPrim sum). If the list of procedure applications [PApp]
is sorted according to the dependencies this translates directly to
Now, it would be nice to have an abstract (functional) encoding of
this such that all symbols can be replaced with lexical variables.