aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog8
-rw-r--r--src/interp/compiler.boot10
-rw-r--r--src/interp/g-util.boot13
-rw-r--r--src/interp/lexing.boot16
-rw-r--r--src/interp/preparse.lisp28
-rw-r--r--src/interp/spad-parser.boot23
-rw-r--r--src/interp/sys-globals.boot3
7 files changed, 42 insertions, 59 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f900aac6..0cd02a90 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2012-05-06 Gabriel Dos Reis <gdr@cse.tamu.edu>
+
+ * interp/sys-globals.boot ($insideCompTypeOf): Remove.
+ * interp/preparse.lisp (INITIAL-SUBSTRING): Remove.
+ * interp/g-util.boot (stringPrefix?): Remove.
+ * interp/compiler.boot (compTypeOf): Remove.
+ (comp3): Don't call it.
+
2012-05-06 Gabriel Dos Reis <gdr@cs.tamu.edu>
* interp/lexing.boot (indentationLocation): New.
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot
index b125c48b..ed256368 100644
--- a/src/interp/compiler.boot
+++ b/src/interp/compiler.boot
@@ -56,7 +56,6 @@ comp3: (%Form,%Mode,%Env) -> %Maybe %Triple
compExpression: (%Form,%Mode,%Env) -> %Maybe %Triple
compAtom: (%Form,%Mode,%Env) -> %Maybe %Triple
compSymbol: (%Form,%Mode,%Env) -> %Maybe %Triple
-compTypeOf: (%Form,%Mode,%Env) -> %Maybe %Triple
compForm: (%Form,%Mode,%Env) -> %Maybe %Triple
compForm1: (%Form,%Mode,%Env) -> %Maybe %Triple
compForm2: (%Form,%Mode,%Env,%List %Modemap) -> %Maybe %Triple
@@ -190,20 +189,11 @@ comp3(x,m,$e) ==
and (T := applyMapping(x,m,e,ml)) => T
op is ":" => compColon(x,m,e)
op is "::" => compCoerce(x,m,e)
- not $insideCompTypeOf and stringPrefix?('"TypeOf",PNAME op) =>
- compTypeOf(x,m,e)
t:= compExpression(x,m,e)
t is [x',m',e'] and not listMember?(m',getDomainsInScope e') =>
[x',m',addDomain(m',e')]
t
-compTypeOf(x:=[op,:argl],m,e) ==
- $insideCompTypeOf: local := true
- newModemap :=
- applySubst(pairList(argl,$FormalMapVariableList),get(op,'modemap,e))
- e:= put(op,'modemap,newModemap,e)
- comp3(x,m,e)
-
++ We just determined that `op' is called with argument list `args', where
++ `op' is either a local capsule function, or an external function
++ with a local signature-import declaration. Emit insn for the call.
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot
index 95e4a47c..4c93b215 100644
--- a/src/interp/g-util.boot
+++ b/src/interp/g-util.boot
@@ -663,19 +663,6 @@ centerString(text,width,fillchar) ==
if f.1 ~= 0 then fill1 := strconc(fillchar,fill1)
[fill1,text,fill2]
-stringPrefix?(pref,str) ==
- -- sees if the first #pref letters of str are pref
- -- replaces STRINGPREFIXP
- not (string?(pref) and string?(str)) => nil
- (lp := # pref) = 0 => true
- lp > # str => nil
- ok := true
- i := 0
- while ok and (i < lp) repeat
- stringChar(pref,i) ~= stringChar(str,i) => ok := nil
- i := i + 1
- ok
-
stringChar2Integer(str,pos) ==
-- returns small integer represented by character in position pos
-- in string str. Returns nil if not a digit or other error.
diff --git a/src/interp/lexing.boot b/src/interp/lexing.boot
index 36b54fd5..4b357918 100644
--- a/src/interp/lexing.boot
+++ b/src/interp/lexing.boot
@@ -44,22 +44,6 @@ module lexing where
matchString: %String -> %Maybe %Short
matchAdvanceString: %String -> %Maybe %Short
matchAdvanceKeyword: %Symbol -> %Thing
- indentationLocation: %String -> %Maybe %Short
-
---%
-
-++ Return the logical indentation position in the `line', after
-++ expansion of leading vertical tab characters.
-indentationLocation line ==
- loc := 0
- n := #line
- for i in 0.. repeat
- i >= n => return nil
- spaceChar? line.i => loc := loc + 1
- tabChar? line.i => loc := 8 * (loc quo 8 + 1)
- return loc
-
---%
--%
--% Line abstract datatype
diff --git a/src/interp/preparse.lisp b/src/interp/preparse.lisp
index 120656b1..dc4836ba 100644
--- a/src/interp/preparse.lisp
+++ b/src/interp/preparse.lisp
@@ -219,10 +219,6 @@
(dolist (X L) (format t "~5d. ~a~%" (car x) (cdr x)))
(format t "~%"))))
-(DEFUN INITIAL-SUBSTRING (PATTERN LINE)
- (let ((ind (mismatch PATTERN LINE)))
- (OR (NULL IND) (EQL IND (SIZE PATTERN)))))
-
(DEFUN SKIP-IFBLOCK (X)
(PROG (LINE IND)
(DCQ (IND . LINE) (preparseReadLine1 X))
@@ -230,19 +226,19 @@
(IF (ZEROP (SIZE LINE)) (RETURN (SKIP-IFBLOCK X)))
(COND ((CHAR= (ELT LINE 0) #\) )
(COND
- ((INITIAL-SUBSTRING ")if" LINE)
+ ((|stringPrefix?| ")if" LINE)
(COND ((EVAL (|string2BootTree| (|storeBlanks!| LINE 3)))
(RETURN (preparseReadLine X)))
('T (RETURN (SKIP-IFBLOCK X)))))
- ((INITIAL-SUBSTRING ")elseif" LINE)
+ ((|stringPrefix?| ")elseif" LINE)
(COND ((EVAL (|string2BootTree| (|storeBlanks!| LINE 7)))
(RETURN (preparseReadLine X)))
('T (RETURN (SKIP-IFBLOCK X)))))
- ((INITIAL-SUBSTRING ")else" LINE)
+ ((|stringPrefix?| ")else" LINE)
(RETURN (preparseReadLine X)))
- ((INITIAL-SUBSTRING ")endif" LINE)
+ ((|stringPrefix?| ")endif" LINE)
(RETURN (preparseReadLine X)))
- ((INITIAL-SUBSTRING ")fin" LINE)
+ ((|stringPrefix?| ")fin" LINE)
(RETURN (CONS IND NIL))))))
(RETURN (SKIP-IFBLOCK X)) ) )
@@ -250,9 +246,9 @@
(PROG (LINE IND)
(DCQ (IND . LINE) (preparseReadLine1 X))
(COND ((NOT (STRINGP LINE)) (RETURN (CONS IND LINE)))
- ((INITIAL-SUBSTRING LINE ")endif")
+ ((|stringPrefix?| LINE ")endif")
(RETURN (preparseReadLine X)))
- ((INITIAL-SUBSTRING LINE ")fin") (RETURN (CONS IND NIL)))
+ ((|stringPrefix?| LINE ")fin") (RETURN (CONS IND NIL)))
('T (RETURN (SKIP-TO-ENDIF X))))))
(DEFUN preparseReadLine (X)
@@ -263,17 +259,17 @@
(RETURN (CONS IND LINE))))
(COND ((CHAR= (ELT LINE 0) #\) )
(COND
- ((INITIAL-SUBSTRING ")if" LINE)
+ ((|stringPrefix?| ")if" LINE)
(COND ((EVAL (|string2BootTree| (|storeBlanks!| LINE 3)))
(RETURN (preparseReadLine X)))
('T (RETURN (SKIP-IFBLOCK X)))))
- ((INITIAL-SUBSTRING ")elseif" LINE)
+ ((|stringPrefix?| ")elseif" LINE)
(RETURN (SKIP-TO-ENDIF X)))
- ((INITIAL-SUBSTRING ")else" LINE)
+ ((|stringPrefix?| ")else" LINE)
(RETURN (SKIP-TO-ENDIF X)))
- ((INITIAL-SUBSTRING ")endif" LINE)
+ ((|stringPrefix?| ")endif" LINE)
(RETURN (preparseReadLine X)))
- ((INITIAL-SUBSTRING ")fin" LINE)
+ ((|stringPrefix?| ")fin" LINE)
(SETQ *EOF* T)
(RETURN (CONS IND NIL)) ) )))
(RETURN (CONS IND LINE)) ))
diff --git a/src/interp/spad-parser.boot b/src/interp/spad-parser.boot
index 50d05c5c..57229713 100644
--- a/src/interp/spad-parser.boot
+++ b/src/interp/spad-parser.boot
@@ -46,6 +46,10 @@ import preparse
import parse
namespace BOOT
+module spad_-parser where
+ indentationLocation: %String -> %Maybe %Short
+ stringPrefix?: (%String,%String) -> %Boolean
+
--%
addClose(line,ch) ==
@@ -64,7 +68,24 @@ infixToken? s ==
atEndOfUnit? x ==
not string? x
---%
+++ Return the logical indentation position in the `line', after
+++ expansion of leading vertical tab characters.
+indentationLocation line ==
+ loc := 0
+ n := #line
+ for i in 0.. repeat
+ i >= n => return nil
+ spaceChar? line.i => loc := loc + 1
+ tabChar? line.i => loc := 8 * (loc quo 8 + 1)
+ return loc
+
+++ Return true if the string `s1' is a prefix of `s2'.
+stringPrefix?(s1,s2) ==
+ n1 := #s1
+ n1 > #s2 => false
+ and/[s1.i = s2.i for i in 0..(n1-1)]
+
+--%
macro compulsorySyntax s ==
s or SPAD__SYNTAX__ERROR()
diff --git a/src/interp/sys-globals.boot b/src/interp/sys-globals.boot
index f611e829..69b3ff63 100644
--- a/src/interp/sys-globals.boot
+++ b/src/interp/sys-globals.boot
@@ -115,9 +115,6 @@ $insideCategoryIfTrue := false
$insideCoerceInteractiveHardIfTrue := false
++
-$insideCompTypeOf := false
-
-++
$insideConstructIfTrue := false
++