aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/boot/parser.boot7
-rw-r--r--src/boot/strap/parser.clisp6
-rw-r--r--src/boot/strap/tokens.clisp7
-rw-r--r--src/boot/tokens.boot6
5 files changed, 27 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 963fe604..564676c1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
2010-07-27 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * boot/tokens.boot: quo and rem are now keywords and infix operators.
+ * boot/parser.boot (bpEuclid): New. Parse integer quotient and
+ remainder expressions.
+ (bpMinus): Now build on bpEuclid instead of bpTimes.
+
+2010-07-27 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/i-analy.boot (bottomUpCompile): Use massageBackendCode in
lieu of mutateToBackendCode.
diff --git a/src/boot/parser.boot b/src/boot/parser.boot
index 107a355f..2962014a 100644
--- a/src/boot/parser.boot
+++ b/src/boot/parser.boot
@@ -651,11 +651,14 @@ bpReduce()==
bpTimes()==
bpReduce() or bpLeftAssoc('(TIMES SLASH),function bpExpt)
+
+bpEuclid() ==
+ bpLeftAssoc('(QUO REM),function bpTimes)
bpMinus()==
- bpInfGeneric '(MINUS) and (bpTimes() or bpTrap())
+ bpInfGeneric '(MINUS) and (bpEuclid() or bpTrap())
and bpPush(bfApplication(bpPop2(),bpPop1()))
- or bpTimes()
+ or bpEuclid()
bpArith()==bpLeftAssoc('(PLUS MINUS),function bpMinus)
diff --git a/src/boot/strap/parser.clisp b/src/boot/strap/parser.clisp
index 802fc8bc..078f48a7 100644
--- a/src/boot/strap/parser.clisp
+++ b/src/boot/strap/parser.clisp
@@ -697,10 +697,12 @@
(DEFUN |bpTimes| ()
(OR (|bpReduce|) (|bpLeftAssoc| '(TIMES SLASH) #'|bpExpt|)))
+(DEFUN |bpEuclid| () (|bpLeftAssoc| '(QUO REM) #'|bpTimes|))
+
(DEFUN |bpMinus| ()
- (OR (AND (|bpInfGeneric| '(MINUS)) (OR (|bpTimes|) (|bpTrap|))
+ (OR (AND (|bpInfGeneric| '(MINUS)) (OR (|bpEuclid|) (|bpTrap|))
(|bpPush| (|bfApplication| (|bpPop2|) (|bpPop1|))))
- (|bpTimes|)))
+ (|bpEuclid|)))
(DEFUN |bpArith| () (|bpLeftAssoc| '(PLUS MINUS) #'|bpMinus|))
diff --git a/src/boot/strap/tokens.clisp b/src/boot/strap/tokens.clisp
index 94923a97..81c97675 100644
--- a/src/boot/strap/tokens.clisp
+++ b/src/boot/strap/tokens.clisp
@@ -12,8 +12,9 @@
(LIST "if" 'IF) (LIST "import" 'IMPORT) (LIST "in" 'IN)
(LIST "is" 'IS) (LIST "isnt" 'ISNT) (LIST "leave" 'LEAVE)
(LIST "module" 'MODULE) (LIST "namespace" 'NAMESPACE)
- (LIST "of" 'OF) (LIST "or" 'OR) (LIST "repeat" 'REPEAT)
- (LIST "return" 'RETURN) (LIST "structure" 'STRUCTURE)
+ (LIST "of" 'OF) (LIST "or" 'OR) (LIST "rem" 'REM)
+ (LIST "repeat" 'REPEAT) (LIST "return" 'RETURN)
+ (LIST "quo" 'QUO) (LIST "structure" 'STRUCTURE)
(LIST "then" 'THEN) (LIST "throw" 'THROW) (LIST "try" 'TRY)
(LIST "until" 'UNTIL) (LIST "where" 'WHERE)
(LIST "while" 'WHILE) (LIST "." 'DOT) (LIST ":" 'COLON)
@@ -165,6 +166,7 @@
(EVAL-WHEN (:EXECUTE :LOAD-TOPLEVEL)
(LET ((|bfVar#7| (LIST (LIST 'SHOEEQ '=) (LIST 'TIMES '*)
+ (LIST 'REM '|rem|) (LIST 'QUO '|quo|)
(LIST 'PLUS '+) (LIST 'IS '|is|)
(LIST 'ISNT '|isnt|) (LIST 'AND '|and|)
(LIST 'OR '|or|) (LIST 'SLASH '/)
@@ -237,6 +239,7 @@
(LIST '|writeByte| 'WRITE-BYTE)
(LIST '|writeLine| 'WRITE-LINE) (LIST 'PLUS '+)
(LIST 'MINUS '-) (LIST 'TIMES '*) (LIST 'POWER 'EXPT)
+ (LIST 'REM 'REM) (LIST 'QUO 'TRUNCATE)
(LIST 'SLASH '/) (LIST 'LT '<) (LIST 'GT '>)
(LIST 'LE '<=) (LIST 'GE '>=) (LIST 'SHOEEQ 'EQUAL)
(LIST 'SHOENE '/=) (LIST 'T 'T$)))
diff --git a/src/boot/tokens.boot b/src/boot/tokens.boot
index 1424c6cd..476d0a62 100644
--- a/src/boot/tokens.boot
+++ b/src/boot/tokens.boot
@@ -56,8 +56,10 @@ shoeKeyWords == [ _
['"namespace", "NAMESPACE"], _
['"of", "OF"] , _
['"or", "OR"] , _
+ ['"rem", "REM"], _
['"repeat", "REPEAT"] , _
['"return", "RETURN"], _
+ ['"quo", "QUO"], _
['"structure", "STRUCTURE"], _
['"then", "THEN"], _
['"throw", "THROW"], _
@@ -187,6 +189,8 @@ for i in [ _
for i in [ _
["SHOEEQ" ,"="], _
["TIMES" ,"*"], _
+ ["REM", "rem"],_
+ ["QUO", "quo"],_
["PLUS" ,"+"], _
["IS" ,"is"], _
["ISNT" ,"isnt"], _
@@ -294,6 +298,8 @@ for i in [ _
["MINUS", "-"] , _
["TIMES", "*"] , _
["POWER", "EXPT"] , _
+ ['REM, 'REM],_
+ ['QUO, 'TRUNCATE],_
["SLASH", "/"] , _
["LT", "<"], _
["GT", ">"] , _