aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-11-02 14:17:56 +0000
committerdos-reis <gdr@axiomatics.org>2011-11-02 14:17:56 +0000
commita28d2c23ae9e87da731b691cdf3306f966b649c2 (patch)
treeae25878a76fc9b8ed89e84234733fbd74b9bdc96
parentc3dea39d035f24533e2aa65309214f7ce2aa9ae6 (diff)
downloadopen-axiom-a28d2c23ae9e87da731b691cdf3306f966b649c2.tar.gz
* interp/spad-parser.boot (parseSpadFile): Use $lineStack not
BOOT-LINE-STACK. Use try/finally to ensure streams are closed. * interp/spad.lisp (New,ENTRY,2): Use parseNewExpr. * interp/util.lisp (string2SpadTree): Likewise.
-rw-r--r--src/ChangeLog7
-rw-r--r--src/interp/spad-parser.boot65
-rw-r--r--src/interp/spad.lisp2
-rw-r--r--src/interp/util.lisp6
4 files changed, 43 insertions, 37 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7e4ed5e1..a41ebcae 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
2011-11-02 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/spad-parser.boot (parseSpadFile): Use $lineStack not
+ BOOT-LINE-STACK. Use try/finally to ensure streams are closed.
+ * interp/spad.lisp (New,ENTRY,2): Use parseNewExpr.
+ * interp/util.lisp (string2SpadTree): Likewise.
+
+2011-11-02 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/c-util.boot (dbSubstituteAllQuantified): New.
* interp/define.boot (NRTmakeCategoryAlist): Use it.
(compDefineFunctor1): Likewise.
diff --git a/src/interp/spad-parser.boot b/src/interp/spad-parser.boot
index 0eb18815..2fb320e5 100644
--- a/src/interp/spad-parser.boot
+++ b/src/interp/spad-parser.boot
@@ -751,40 +751,39 @@ parseSpecialCommand() ==
++ ??? meaningful. Eventually this code will go away when we
++ ??? finally use the new parser everwhere.
parseSpadFile sourceFile ==
- $SPAD := true -- we are parsing Spad,
- SETQ(_*EOF_*, false) -- end of current input?
+ $SPAD: local := true -- we are parsing Spad,
+ _*EOF_*: local := false -- end of current input?
FILE_-CLOSED : local := false -- current stream closed?
-
- $OutputStream := MAKE_-SYNONYM_-STREAM "*STANDARD-OUTPUT*" -- noise to standard output
- -- we need to tell the post-parsing transformers that we're compiling
- -- Spad because few parse forms have slightly different representations
- -- depending on whether we are interpreter mode or compiler mode.
- $InteractiveMode: local := false
- INIT_-BOOT_/SPAD_-READER()
- -- we need to restore the global input stream state after we
- -- finished messing with it.
- savedInStream := (IN_-STREAM : local)
-
- -- If soureFile cannot be processed for whatever reasons
- -- get out of here instead of being stuck later.
- not (IN_-STREAM := MAKE_-INSTREAM sourceFile) =>
- IN_-STREAM := savedInStream
- systemError '"cannot open input source file"
- INITIALIZE_-PREPARSE IN_-STREAM
-
- -- gather parse trees for all toplevel expressions in sourceFile.
- asts := []
- while not (_*EOF_* or FILE_-CLOSED) repeat
- BOOT_-LINE_-STACK : local := PREPARSE IN_-STREAM
- LINE : local := CDAR BOOT_-LINE_-STACK
- CATCH('SPAD__READER,parseNewExpr())
- asts := [parseTransform postTransform popStack1(), :asts]
- -- clean up the mess, and get out of here
- IOCLEAR(IN_-STREAM, OUT_-STREAM)
- SHUT IN_-STREAM
- IN_-STREAM := savedInStream
- -- we accumulated the parse trees in reverse order
- reverse! asts
+ try
+ -- noise to standard output
+ $OutputStream: local := MAKE_-SYNONYM_-STREAM "*STANDARD-OUTPUT*"
+ -- we need to tell the post-parsing transformers that we're compiling
+ -- Spad because few parse forms have slightly different representations
+ -- depending on whether we are interpreter mode or compiler mode.
+ $InteractiveMode: local := false
+ INIT_-BOOT_/SPAD_-READER()
+ -- we need to restore the global input stream state after we
+ -- finished messing with it.
+ IN_-STREAM: local := MAKE_-INSTREAM sourceFile
+
+ -- If soureFile cannot be processed for whatever reasons
+ -- get out of here instead of being stuck later.
+ IN_-STREAM = nil =>
+ systemError '"cannot open input source file"
+ INITIALIZE_-PREPARSE IN_-STREAM
+
+ -- gather parse trees for all toplevel expressions in sourceFile.
+ asts := []
+ while not (_*EOF_* or FILE_-CLOSED) repeat
+ $lineStack: local := PREPARSE IN_-STREAM
+ LINE: local := CDAR $lineStack
+ CATCH('SPAD__READER,parseNewExpr())
+ asts := [parseTransform postTransform popStack1(), :asts]
+ -- we accumulated the parse trees in reverse order
+ reverse! asts
+ finally -- clean up the mess, and get out of here
+ IOCLEAR(IN_-STREAM, OUT_-STREAM)
+ SHUT IN_-STREAM
--%
diff --git a/src/interp/spad.lisp b/src/interp/spad.lisp
index 2de5aaaa..dfd21b81 100644
--- a/src/interp/spad.lisp
+++ b/src/interp/spad.lisp
@@ -273,7 +273,7 @@
(let (zz)
(INITIALIZE)
(SETQ |$previousTime| (TEMPUS-FUGIT))
- (setq ZZ (CONVERSATION '|PARSE-NewExpr| '|process|))
+ (setq ZZ (CONVERSATION '|parseNewExpr| '|process|))
INPUTSTREAM))
(defun INITIALIZE ()
diff --git a/src/interp/util.lisp b/src/interp/util.lisp
index 0a6800cb..9c103e5e 100644
--- a/src/interp/util.lisp
+++ b/src/interp/util.lisp
@@ -266,10 +266,10 @@
(if (and (> (LENGTH LINE) 0) (EQ (CHAR LINE 0) #\) ))
(|processSynonyms|))
(ioclear)
- (LET* ((BOOT-LINE-STACK (LIST (CONS 1 LINE)))
+ (LET* ((|$lineStack| (LIST (CONS 1 LINE)))
($SPAD T)
- (PARSEOUT (PROG2 (|PARSE-NewExpr|) (|popStack1|))))
- (DECLARE (SPECIAL BOOT-LINE-STACK $SPAD))
+ (PARSEOUT (PROG2 (|parseNewExpr|) (|popStack1|))))
+ (DECLARE (SPECIAL |$lineStack| $SPAD))
PARSEOUT))