diff options
author | dos-reis <gdr@axiomatics.org> | 2008-12-11 22:55:24 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-12-11 22:55:24 +0000 |
commit | 747aae4a7e6de144f8692e68c04ba17bae47dc9d (patch) | |
tree | 3d35d18bd3f5955e9c3a0ddd60339b2dcfc937de /src/interp | |
parent | 8f409fc75c64b9c486ec74419de9785c00629a17 (diff) | |
download | open-axiom-747aae4a7e6de144f8692e68c04ba17bae47dc9d.tar.gz |
r12436@gauss: gdr | 2008-12-09 21:32:50 -0600
Modularize S-PROCESS.
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/compiler.boot | 35 | ||||
-rw-r--r-- | src/interp/spad.lisp | 20 |
2 files changed, 36 insertions, 19 deletions
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index 5aa9e6cb..78a8145c 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -1874,6 +1874,41 @@ compMatch(["%Match",subject,altBlock],m,e) == code := ["LET",[[sn,se]],["COND",:nreverse altsCode]] [code,m,savedEnv] + +--% Entry point to the compiler + +preprocessParseTree pt == + $postStack := [] + pf := parseTransform postTransform pt + $postStack = nil => pf + displayPreCompilationErrors() + nil + +++ Takes a parse tree `pt', typecheck it and compile it down +++ to VM instructions. +compileParseTree pt == + pt = nil => nil + CURSTRM: local := $OutputStream + pf := preprocessParseTree pt + pf = nil => nil -- stop if preprocessing was a disaster. + -- Don't go further if only preprocessing was requested. + $PrintOnly => + FORMAT(true,'"~S =====>~%",$currentLine) + PRETTYPRINT pf + -- Now start actual compilation. + $x: local := nil -- ??? + $m: local := nil -- ??? + $s: local := nil -- ??? + $exitModeStack: local := [] -- Used by the compiler proper + -- We don't usually call the compiler to process interpreter + -- input, however attempt to second guess nevertheless. + if $InteractiveMode then + processInteractive(pf,nil) + else if T := compTopLevel(pf,$EmptyMode,$InteractiveFrame) then + [.,.,$InteractiveFrame] := T + TERPRI() + + --% Register compilers for special forms. -- Those compilers are on the `SPECIAL' property of the corresponding -- special form operator symbol. diff --git a/src/interp/spad.lisp b/src/interp/spad.lisp index 83283cfb..aefc8608 100644 --- a/src/interp/spad.lisp +++ b/src/interp/spad.lisp @@ -293,25 +293,7 @@ (|$genSDVar| 0) (|$VariableCount| 0) (|$previousTime| (TEMPUS-FUGIT))) - (prog ((CURSTRM |$OutputStream|) |$s| |$x| |$m| u) - (declare (special CURSTRM |$s| |$x| |$m|)) - (SETQ |$exitModeStack| ()) - (SETQ |$postStack| nil) - (SETQ |$TraceFlag| T) - (if (NOT X) (RETURN NIL)) - (setq X (|parseTransform| (|postTransform| X))) - ;; (if |$TranslateOnly| (RETURN (SETQ |$Translation| X))) - (when |$postStack| (|displayPreCompilationErrors|) (RETURN NIL)) - (COND (|$PrintOnly| - (format t "~S =====>~%" |$currentLine|) - (RETURN (PRETTYPRINT X)))) - (if |$InteractiveMode| - (|processInteractive| X NIL) - (if (setq U (|compTopLevel| X |$EmptyMode| - |$InteractiveFrame|)) - (SETQ |$InteractiveFrame| (third U)))) - (if |$semanticErrorStack| (|displaySemanticErrors|)) - (TERPRI)))) + (|compileParseTree| X))) (MAKEPROP 'END_UNIT 'KEY T) |