aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-10-18 01:27:42 +0000
committerdos-reis <gdr@axiomatics.org>2011-10-18 01:27:42 +0000
commit630b6f25ff2900a31326141b67a187a685e7e9b8 (patch)
treef87d21c2387137ff8500e0e0ede9f2dbcabac64a /src/interp
parent16111656afaa94a382d61de6c3ec37a9bdca05ef (diff)
downloadopen-axiom-630b6f25ff2900a31326141b67a187a685e7e9b8.tar.gz
* interp/spad-parser.boot (parseSegmentTail): Tidy.
* interp/postpar.boot (postSEGMENT): Remove. (postTupleCollect): Likewise. (postBootNotEqual): Likewise. * interp/parsing.lisp (CHAR-EQ): Remove. (CHAR-NE): Likewise. (getToken): Likewise. * interp/newaux.lisp: Remove "^=" as legitimate operator. * interp/lexing.boot (geToken): Rename from getSpadToken. * interp/i-intern.boot (mkAtree3): Check for new form of universal segment. * interp/parse.boot (parseSegment): Likewise. * algebra/seg.spad.pamphlet (Segment): Use .. instead of SEGMENT. (SegmentFunctions2): Likewise. (UniversalSegment): Likewise.
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/i-intern.boot6
-rw-r--r--src/interp/lexing.boot4
-rw-r--r--src/interp/newaux.lisp2
-rw-r--r--src/interp/parse.boot4
-rw-r--r--src/interp/parsing.lisp6
-rw-r--r--src/interp/postpar.boot22
-rw-r--r--src/interp/spad-parser.boot14
7 files changed, 14 insertions, 44 deletions
diff --git a/src/interp/i-intern.boot b/src/interp/i-intern.boot
index b8be53f7..61533d39 100644
--- a/src/interp/i-intern.boot
+++ b/src/interp/i-intern.boot
@@ -195,10 +195,10 @@ mkAtree3(x,op,argl) ==
op="=" => [mkAtreeNode "equation",:[mkAtree1 arg for arg in argl]]
op="not" and argl is [["=",lhs,rhs]] =>
[mkAtreeNode "not",[mkAtreeNode "=",mkAtree1 lhs,mkAtree1 rhs]]
- op="in" and argl is [var ,["SEGMENT",lb,ul]] =>
+ op="in" and argl is [var ,["SEGMENT",lb,:ul]] =>
upTest:=
- null ul => nil
- mkLessOrEqual(var,ul)
+ ul = nil => nil
+ mkLessOrEqual(var,first ul)
lowTest:=mkLessOrEqual(lb,var)
z :=
ul => ['and,lowTest,upTest]
diff --git a/src/interp/lexing.boot b/src/interp/lexing.boot
index 325aa513..8b0e1b7e 100644
--- a/src/interp/lexing.boot
+++ b/src/interp/lexing.boot
@@ -188,7 +188,7 @@ tokenInstall(sym,typ,tok,nonblank == true) ==
tokenNonblank?(tok) := nonblank
tok
-getSpadToken tok ==
+getToken tok ==
not skipBlankChars() => nil
tt := tokenLookaheadType currentChar()
tt is 'EOF => tokenInstall(nil,'_*EOF,tok,$nonblank)
@@ -203,7 +203,7 @@ getSpadToken tok ==
getGliph(tok,tt)
tryGetToken tok ==
- getSpadToken tok =>
+ getToken tok =>
$validTokens := $validTokens + 1
tok
nil
diff --git a/src/interp/newaux.lisp b/src/interp/newaux.lisp
index 3d668367..3e85eb7d 100644
--- a/src/interp/newaux.lisp
+++ b/src/interp/newaux.lisp
@@ -109,7 +109,7 @@
(< 400 400) (> 400 400)
(<< 400 400) (>> 400 400)
(<= 400 400) (>= 400 400)
- (= 400 400) (^= 400 400)
+ (= 400 400)
(~= 400 400)
(|in| 400 400)
(|case| 400 400)
diff --git a/src/interp/parse.boot b/src/interp/parse.boot
index 9f30064d..f980de7c 100644
--- a/src/interp/parse.boot
+++ b/src/interp/parse.boot
@@ -311,8 +311,8 @@ parseInBy t ==
parseSegment: %ParseForm -> %Form
parseSegment p ==
- p is ["SEGMENT",a,b] =>
- b => ["SEGMENT",parseTran a, parseTran b]
+ p is ["SEGMENT",a,:b] =>
+ b => ["SEGMENT",parseTran a, parseTran first b]
["SEGMENT",parseTran a]
-- SEGMENT is being elted from a domain
["SEGMENT",:rest p]
diff --git a/src/interp/parsing.lisp b/src/interp/parsing.lisp
index ce5a2826..565fce93 100644
--- a/src/interp/parsing.lisp
+++ b/src/interp/parsing.lisp
@@ -602,10 +602,6 @@ the stack, then stack a NIL. Return the value of prod."
;; auxiliary functions needed by the parser
-(defun char-eq (x y) (char= (character x) (character y)))
-
-(defun char-ne (x y) (char/= (character x) (character y)))
-
(Defun FLOATEXPID (X &aux S)
(if (AND (IDENTP X) (char= (char-upcase (ELT (SETQ S (PNAME X)) 0)) #\E)
(> (LENGTH S) 1)
@@ -614,8 +610,6 @@ the stack, then stack a NIL. Return the value of prod."
(READ-FROM-STRING S t nil :start 1)
NIL))
-(defun |getToken| (x) (if (EQCAR x '|elt|) (third x) x))
-
(defun |dollarTran| (dom rand)
(let ((eltWord (if |$InteractiveMode| '|$elt| '|elt|)))
(if (and (not (atom rand)) (cdr rand))
diff --git a/src/interp/postpar.boot b/src/interp/postpar.boot
index aa279f98..aba24540 100644
--- a/src/interp/postpar.boot
+++ b/src/interp/postpar.boot
@@ -346,12 +346,6 @@ postRepeat t ==
t isnt ["REPEAT",:m,x] => systemErrorHere ["postRepeat",t]
["REPEAT",:postIteratorList m,postTran x]
-postSEGMENT: %ParseTree -> %ParseForm
-postSEGMENT t ==
- t isnt ["SEGMENT",a,b] => systemErrorHere ["postSEGMENT",t]
- key:= [a,'"..",:(b => [b]; nil)]
- postError ['" Improper placement of segment",:bright key]
-
postCollect: %ParseTree -> %ParseForm
postCollect t ==
t isnt [constructOp,:m,x] => systemErrorHere ["postCollect",t]
@@ -371,11 +365,6 @@ postCollect t ==
["REDUCE","append",0,[op,:itl,newBody]]
[op,:itl,y]
-postTupleCollect: %ParseTree -> %ParseForm
-postTupleCollect t ==
- t isnt [constructOp,:m,x] => systemErrorHere ["postTupleCollect",t]
- postCollect [constructOp,:m,["construct",x]]
-
postIteratorList: %List %ParseTree -> %List %ParseForm
postIteratorList x ==
x is [p,:l] =>
@@ -530,15 +519,6 @@ unComma x ==
x is ["%Comma",:y] => y
[x]
---% `^='
-++ check that `^=' is not used in Spad code to mean `not equal'.
-postBootNotEqual: %ParseTree -> %ParseForm
-postBootNotEqual u ==
- checkWarning ['"Operator ", :bright '"^=",
- '"is not valid Spad. Please use",:bright '"~=",'"instead."]
- ["~=",:postTran rest u]
-
-
--% %Match
postAlternatives alts ==
@@ -570,7 +550,6 @@ for x in [["with", :"postWith"],_
["in", :"postin"],_
["IN", :"postIn"],_
["REPEAT", :"postRepeat"],_
- ["TupleCollect", :"postTupleCollect"],_
["add", :"postAdd"],_
["%Reduce", :"postReduce"],_
[",", :"postComma"],_
@@ -588,7 +567,6 @@ for x in [["with", :"postWith"],_
["->", :"postMapping"],_
["=>", :"postExit"],_
["%Match",:"postMatch"],_
- ["^=", :"postBootNotEqual"],_
["%Comma", :"post%Comma"]] repeat
property(first x, 'postTran) := rest x
diff --git a/src/interp/spad-parser.boot b/src/interp/spad-parser.boot
index 43e04256..894907b2 100644
--- a/src/interp/spad-parser.boot
+++ b/src/interp/spad-parser.boot
@@ -334,11 +334,10 @@ parseExpression() ==
parseSegmentTail() ==
parseGlyph ".." =>
- stackUpdated?($reduceStack) := false
- parseExpression()
- if not stackUpdated? $reduceStack then
- pushReduction('segmentTail,nil)
- pushReduction('parseSegmentTail,["SEGMENT",popStack2(),popStack1()])
+ seg :=
+ parseExpression() => ["SEGMENT",popStack2(),popStack1()]
+ ["SEGMENT",popStack1()]
+ pushReduction('parseSegmentTail,seg)
nil
parseReductionOp() ==
@@ -547,7 +546,7 @@ parseLoop() ==
parseOpenBracket() ==
s := currentSymbol()
- getToken s is "[" =>
+ s is "[" or s is ["elt",.,"["] =>
do
s is ["elt",:.] =>
pushReduction('parseOpenBracket,["elt",second s,"construct"])
@@ -558,7 +557,7 @@ parseOpenBracket() ==
parseOpenBrace() ==
s := currentSymbol()
- getToken s is "{" =>
+ s is "{" or s is ["elt",.,"{"] =>
do
s is ["elt",:.] =>
pushReduction('parseOpenBracket,["elt",second s,"brace"])
@@ -805,7 +804,6 @@ for x in [
[">", ["="], [">"]],_
["=", ["=", [">"]] ,[">"]],_
[".", ["."]],_
- ["^", ["="]],_
["~", ["="]],_
["[", ["|"]],_
[":", ["="], ["-"], [":"]]_