aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO1
-rw-r--r--src/ChangeLog9
-rw-r--r--src/interp/cparse.boot1
-rw-r--r--src/interp/i-map.boot11
-rw-r--r--src/interp/pf2sex.boot15
5 files changed, 34 insertions, 3 deletions
diff --git a/TODO b/TODO
index d3d7728c..05e9f0b0 100644
--- a/TODO
+++ b/TODO
@@ -2,6 +2,7 @@
=== TODO ===
============
+* Fix parse tree transformation (e.g. typed definitions.)
* Cleanup commuting coercion facility.
* Improve efficiency of array operations.
* Rework subsumption.
diff --git a/src/ChangeLog b/src/ChangeLog
index 463e45cb..03d653b5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,14 @@
2010-05-22 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/cparse.boot (npDefinitionItem): Consider a declaration as
+ a definition item too.
+ * interp/i-map.boot (addDefMap): Don't confuse constant
+ with niladic functions.
+ * interp/pf2sex.boot (pfDefinition2Sex): Don't be confused by
+ typed constant definitions.
+
+2010-05-22 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/ptrees.boot (pfWith): Now a function of two arguments.
(pfWithWithon): Remove.
(pfDefinableName?): New.
diff --git a/src/interp/cparse.boot b/src/interp/cparse.boot
index 11118d31..07640279 100644
--- a/src/interp/cparse.boot
+++ b/src/interp/cparse.boot
@@ -1010,6 +1010,7 @@ npDefinitionItem()==
npMdef "MDEF"
npRestore a
npMacro() or npDefn()
+ or npName() and npDecl()
npTrap()
npDefinition() ==
diff --git a/src/interp/i-map.boot b/src/interp/i-map.boot
index 03c15c50..7832613a 100644
--- a/src/interp/i-map.boot
+++ b/src/interp/i-map.boot
@@ -88,10 +88,18 @@ addDefMap(['DEF,lhs,mapsig,.,rhs],pred) ==
-- next check is for bad forms on the lhs of the ==, such as
-- numbers, constants.
+
+ -- FIXME: this function miguidedly characterizes constant definitions
+ -- as rules definitions. In particular, typed constant definitions
+ -- are characterized are rules in one part, and announced to user
+ -- a niladic functions. We try to limit the damage as much as we can.
+ defineeIsConstant := false
+
if atom lhs then
op := lhs
putHist(op,'isInterpreterRule,true,$e)
putHist(op,'isInterpreterFunction,false,$e)
+ defineeIsConstant := true
lhs := [lhs]
else
-- this is a function definition. If it has been declared
@@ -132,7 +140,8 @@ addDefMap(['DEF,lhs,mapsig,.,rhs],pred) ==
if allDecs then
mapmode := nreverse mapmode
putHist(op,'mode,mapmode,$e)
- sayKeyedMsg("S2IM0006",[formatOpSignature(op,rest mapmode)])
+ if not defineeIsConstant then
+ sayKeyedMsg("S2IM0006",[formatOpSignature(op,rest mapmode)])
else if someDecs then throwKeyedMsg("S2IM0007",[op])
-- if map is declared, check that signature arg count is the
diff --git a/src/interp/pf2sex.boot b/src/interp/pf2sex.boot
index 2735580e..0e3904f1 100644
--- a/src/interp/pf2sex.boot
+++ b/src/interp/pf2sex.boot
@@ -307,8 +307,19 @@ pfDefinition2Sex pf ==
systemError '"lhs of definition must be a single item in the interpreter"
id := first idList
rhs := pfDefinitionRhs pf
- [argList, :body] := pfLambdaTran rhs
- ["DEF", (argList = 'id => id; [id, :argList]), :body]
+ lhs := nil
+ body := nil
+ -- Sometimes, a typed constant definition is mischaracterized as
+ -- a definition of the colon delimiter.
+ if id is [":",id',t] then
+ id := id'
+ if pfLambda? rhs then
+ [argList, :body] := pfLambdaTran rhs
+ lhs := [id,:argList]
+ else
+ lhs := id
+ body := [[t],[nil],pf2Sex1 rhs]
+ ["DEF",lhs,:body]
pfLambdaTran pf ==
pfLambda? pf =>