summaryrefslogtreecommitdiff
path: root/il.fun
diff options
context:
space:
mode:
Diffstat (limited to 'il.fun')
-rw-r--r--il.fun36
1 files changed, 36 insertions, 0 deletions
diff --git a/il.fun b/il.fun
new file mode 100644
index 0000000..bcf4f29
--- /dev/null
+++ b/il.fun
@@ -0,0 +1,36 @@
+functor IL(P: PARSER) = struct
+
+ structure P = P
+ structure PP = P.P
+
+ datatype ctx = Ctx of {
+ objs: P.objDef list,
+ objsZI: P.objDef list,
+ extSyms: P.nid list,
+ globSyms: P.nid list,
+ funcs: P.funcInfo list,
+ strlits: int list
+ }
+
+ fun createCtx ({ ext, glob, objsZI, objs, funcs, strlits }) =
+ Ctx { objs, objsZI, extSyms = ext, globSyms = glob, funcs, strlits }
+
+ fun updateCtx (Ctx ctx) = fn z =>
+ let
+ fun from objs objsZI extSyms globSyms funcs strlits =
+ { objs, objsZI, extSyms, globSyms, funcs, strlits }
+ fun to f { objs, objsZI, extSyms, globSyms, funcs, strlits } =
+ f objs objsZI extSyms globSyms funcs strlits
+ in
+ FRU.makeUpdate6 (from, from, to) ctx (fn (a, f) => z (a, Ctx o f))
+ end
+
+ fun register ctx (P.Objects revObjs) =
+ updateCtx ctx u#objs (fn objs => List.revAppend (revObjs, objs)) %
+ | register ctx (P.Definition _) = ctx
+
+ (*
+ type objDef = int * P.tkPos * ctype * cini * linkage
+ type decl = P.tkPos * declClass * ctype * linkage
+ *)
+end