aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-12-11 22:55:24 +0000
committerdos-reis <gdr@axiomatics.org>2008-12-11 22:55:24 +0000
commit747aae4a7e6de144f8692e68c04ba17bae47dc9d (patch)
tree3d35d18bd3f5955e9c3a0ddd60339b2dcfc937de /src
parent8f409fc75c64b9c486ec74419de9785c00629a17 (diff)
downloadopen-axiom-747aae4a7e6de144f8692e68c04ba17bae47dc9d.tar.gz
r12436@gauss: gdr | 2008-12-09 21:32:50 -0600
Modularize S-PROCESS.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/interp/compiler.boot35
-rw-r--r--src/interp/spad.lisp20
3 files changed, 42 insertions, 19 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 96534806..d8b9344d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
2008-12-09 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/compiler.boot (preprocessParseTree): New.
+ (compileParseTree): New. Split out of S-PROCESS.
+ * interp/spad.lisp (S-PROCESS): Use it.
+
+2008-12-09 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* algebra/term.spad.pamphlet: New. Implement Arity and
OperatorCategory.
* algebra/Makefile.pamphlet (axiom_algebra_layer_15): Include ARITY.
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)