From a50eb601b4dc0699cde4084584763798ee8dab02 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sun, 20 Sep 2009 04:30:17 +0000 Subject: * boot/tokens.boot: "has" is not a keyword. * boot/ast.boot (bfHas): New. (bfReduce): Use "has" instead "has". (bfReduceCollect): Likewise. (bfReName): Likewise. (bfElt): Likewise. (bfSetelt): Likewise. * boot/parser.boot (bpSexpKey): Likewise. (bpPrefixOperator): Likewise. (bpInfixOperator): Likewise. (bpThetaName): Likewise. (bpIs): Parse "has" expressions. * boot/pile.boot (shoePileCoagulate): Likewise. * interp/: Fix unquoted use of "has". * interp/interop.boot (has): Remove. --- src/boot/ast.boot | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/boot/ast.boot') diff --git a/src/boot/ast.boot b/src/boot/ast.boot index c83e95c6..0e7b50a8 100644 --- a/src/boot/ast.boot +++ b/src/boot/ast.boot @@ -335,7 +335,7 @@ bfReduce(op,y)== op is ["QUOTE",:.] => second op op op := bfReName a - init := GET(a,"SHOETHETA") or GET(op,"SHOETHETA") + init := a has SHOETHETA or op has SHOETHETA g := bfGenSymbol() g1 := bfGenSymbol() body := ['SETQ,g,[op,g,g1]] @@ -357,7 +357,7 @@ bfReduceCollect(op,y)== op is ["QUOTE",:.] => second op op op := bfReName a - init := GET(a, "SHOETHETA") or GET(op,"SHOETHETA") + init := a has SHOETHETA or op has SHOETHETA bfOpReduce(op,init,body,itl) bfReduce(op,bfTupleConstruct (y.1)) @@ -666,14 +666,19 @@ bfIS1(lhs,rhs) == bfAND [rev,:l2,['PROGN,bfLetForm(a,['NREVERSE,a]),'T]] bpSpecificErrorHere '"bad IS code is generated" bpTrap() - + + +bfHas(expr,prop) == + IDENTP prop => ["GET",expr,["QUOTE",prop]] + bpSpecificErrorAtToken('"expected identifier as property name") + bfApplication(bfop, bfarg) == bfTupleP bfarg => [bfop,:rest bfarg] [bfop,bfarg] -- returns the meaning of x in the appropriate Boot dialect. bfReName x== - a := GET(x,"SHOERENAME") => first a + a := x has SHOERENAME => first a x bfInfApplication(op,left,right)== @@ -932,14 +937,14 @@ bfSetelt(e,l,r)== bfSetelt(bfElt(e,first l),rest l,r) bfElt(expr,sel)== - y:=SYMBOLP sel and GET(sel,"SHOESELFUNCTION") + y:=SYMBOLP sel and sel has SHOESELFUNCTION y => INTEGERP y => ["ELT",expr,y] [y,expr] ["ELT",expr,sel] defSETELT(var,sel,expr)== - y := SYMBOLP sel and GET(sel,"SHOESELFUNCTION") + y := SYMBOLP sel and sel has SHOESELFUNCTION y => INTEGERP y => ["SETF",["ELT",var,y],expr] ["SETF",[y,var],expr] -- cgit v1.2.3