aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog13
-rw-r--r--src/interp/cparse.boot28
2 files changed, 29 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d571e3e4..c2b9767b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,18 @@
2008-08-05 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/cparse.boot (npWith): Commit to parsing upon `with'.
+ (npAdd): Commit to parsing upon `add'.
+ (npDef): Tell npDefTail to look for '=='.
+ (npMdef): Accept argument to indicate '==' or '==>' forms.
+ (npSingleRule): A Rule is given by '=='.
+ (npDefTail): Take the kind of definition as a parameter.
+ (npDefinitionItem): Macro definitions are definitions.
+ (npMDEFinition): Remove.
+ (npMDEF): Hand off to npMdef to parse macro definitions.
+ (npMacro): Macros introduced by `macro' keyword uses '=='.
+
+2008-08-05 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/cparse.boot (npExpress1): Make assignment an expression,
therefore a statement.
diff --git a/src/interp/cparse.boot b/src/interp/cparse.boot
index 6d39b924..4a5291f7 100644
--- a/src/interp/cparse.boot
+++ b/src/interp/cparse.boot
@@ -599,9 +599,9 @@ npBackTrack(p1,p2,p3)==
true
false
-npMDEF()== npBackTrack(function npStatement,"MDEF",function npMDEFinition)
-
-npMDEFinition() == npPP function npMdef
+npMDEF() ==
+ npBackTrack(function npStatement,"MDEF",
+ function LAMBDA(nil, npMdef "MDEF"))
npAssign()== npBackTrack(function npMDEF,"BECOMES",function npAssignment)
@@ -707,12 +707,13 @@ npDefn()== npEqKey "DEFN" and npPP function npDef
npFix()== npEqKey "FIX" and npPP function npDef
and npPush pfFix npPop1 ()
-npMacro()== npEqKey "MACRO" and npPP function npMdef
+npMacro() ==
+ npEqKey "MACRO" and npPP function LAMBDA(nil, npMdef "DEF")
npRule()== npEqKey "RULE" and npPP function npSingleRule
npAdd(extra)==
- npEqKey "ADD" and
+ npEqKey "ADD" =>
a:=npState()
npDefinitionOrStatement() or npTrap()
npEqPeek "IN" =>
@@ -729,7 +730,7 @@ npDefaultValue()==
and npPush [pfAdd(pfNothing(),npPop1(),pfNothing())]
npWith(extra)==
- npEqKey "WITH" and
+ npEqKey "WITH" =>
a:=npState()
npCategoryL() or npTrap()
npEqPeek "IN" =>
@@ -889,19 +890,19 @@ npLambda()==
npDef()==
npMatch() =>
[op,arg,rt]:= pfCheckItOut(npPop1())
- npDefTail() or npTrap()
+ npDefTail "DEF" or npTrap()
body:=npPop1()
null arg => npPush pfDefinition (op,body)
npPush pfDefinition (op,pfPushBody(rt,arg,body))
false
---npDefTail()== npEqKey "DEF" and npDefinitionOrStatement()
-npDefTail()== (npEqKey "DEF" or npEqKey "MDEF") and npDefinitionOrStatement()
+npDefTail kw ==
+ npEqKey kw and npDefinitionOrStatement()
-npMdef()==
+npMdef kw ==
npQuiver() =>
[op,arg]:= pfCheckMacroOut(npPop1())
- npDefTail() or npTrap()
+ npDefTail kw or npTrap()
body:=npPop1()
null arg => npPush pfMacro (op,body)
npPush pfMacro (op,pfPushMacroBody(arg,body))
@@ -910,7 +911,7 @@ npMdef()==
npSingleRule()==
npQuiver() =>
- npDefTail() or npTrap()
+ npDefTail "DEF" or npTrap()
npPush pfRule (npPop2(),npPop1())
false
@@ -922,6 +923,9 @@ npDefinitionItem()==
npEqPeek "DEF" =>
npRestore a
npDef()
+ npEqPeek "MDEF" =>
+ npRestore a
+ npMdef "MDEF"
npRestore a
npMacro() or npDefn()
npTrap()