summaryrefslogtreecommitdiff
path: root/driver.fun
diff options
context:
space:
mode:
authorVladimir Azarov <avm@intermediate-node.net>2025-08-04 22:13:17 +0200
committerVladimir Azarov <avm@intermediate-node.net>2025-08-04 22:13:17 +0200
commita4c60603f61dd1a9f0ce420be9067965586dd694 (patch)
treec5f48221a8291b817d6eec0fd3f70eeb8c26a300 /driver.fun
parent396ebf0c76153e5e1e9dc77371bdd02b4d3d85d1 (diff)
Object assembly
Diffstat (limited to 'driver.fun')
-rw-r--r--driver.fun21
1 files changed, 12 insertions, 9 deletions
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)