diff options
author | Vladimir Azarov <avm@intermediate-node.net> | 2025-08-04 22:13:17 +0200 |
---|---|---|
committer | Vladimir Azarov <avm@intermediate-node.net> | 2025-08-04 22:13:17 +0200 |
commit | a4c60603f61dd1a9f0ce420be9067965586dd694 (patch) | |
tree | c5f48221a8291b817d6eec0fd3f70eeb8c26a300 /driver.fun | |
parent | 396ebf0c76153e5e1e9dc77371bdd02b4d3d85d1 (diff) |
Object assembly
Diffstat (limited to 'driver.fun')
-rw-r--r-- | driver.fun | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -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) |