summaryrefslogtreecommitdiff
path: root/driver.fun
diff options
context:
space:
mode:
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)