From a4c60603f61dd1a9f0ce420be9067965586dd694 Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Mon, 4 Aug 2025 22:13:17 +0200 Subject: Object assembly --- il.fun | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 il.fun (limited to 'il.fun') 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 -- cgit v1.2.3