From a4c60603f61dd1a9f0ce420be9067965586dd694 Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Mon, 4 Aug 2025 22:13:17 +0200 Subject: Object assembly --- driver.fun | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'driver.fun') diff --git a/driver.fun b/driver.fun index ac9f950..0f80f41 100644 --- a/driver.fun +++ b/driver.fun @@ -1,5 +1,6 @@ -functor Driver(P: PARSER): DRIVER = struct - structure P = P +functor Driver(E: EMIT): DRIVER = struct + structure I = E.I + structure P = E.I.P datatype execMode = Normal | DebugE | DebugT @@ -56,17 +57,19 @@ functor Driver(P: PARSER): DRIVER = struct fun collect ctx = let - val result = P.parseDef ctx + val (continue, ctx) = P.parseDef ctx in - case result of - NONE => () - | SOME (def, ctx) => ( - P.printDef def; + if continue then collect ctx - ) + else + P.finalize ctx end + + val parseCtx = collect parseCtx + val progInfo = P.explode parseCtx + val ilCtx = I.createCtx progInfo in - collect parseCtx + E.emit "/tmp/prog.s" ilCtx end | DebugT => P.P.T.debugPrint file | DebugE => P.P.debugPrint file (#includeDirs config) -- cgit v1.2.3