From 5c205afa0596a29c6e8de395d3b2adbd89e02ae8 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sat, 29 May 2010 12:40:26 +0000 Subject: More support middle end logical operators --- src/interp/i-funsel.boot | 26 +++++++++++++------------- src/interp/i-map.boot | 4 ++-- src/interp/nruncomp.boot | 6 +++--- src/interp/nrunfast.boot | 4 ++-- src/interp/nrungo.boot | 6 +++--- src/interp/nrunopt.boot | 9 +++++---- src/interp/wi2.boot | 4 ++-- 7 files changed, 30 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/interp/i-funsel.boot b/src/interp/i-funsel.boot index 29f33844..b75f710a 100644 --- a/src/interp/i-funsel.boot +++ b/src/interp/i-funsel.boot @@ -909,13 +909,13 @@ matchMmCond(cond) == -- cond is 'T or a list, but I hate to test for 'T (ALBI) $domPvar: local := nil atom cond or - cond.op in '(AND _and %and) => + cond.op in '(AND and %and) => and/[matchMmCond c for c in cond.args] - cond.op in '(OR _or %or) => + cond.op in '(OR or %or) => or/[matchMmCond c for c in cond.args] cond is ["has",dom,x] => hasCaty(dom,x,NIL) ~= 'failed - cond is [op,cond1] and op in '(_not NOT %not) => not matchMmCond cond1 + cond is [op,cond1] and op in '(not NOT %not) => not matchMmCond cond1 keyedSystemError("S2GE0016", ['"matchMmCond",'"unknown form of condition"]) @@ -1165,9 +1165,9 @@ evalMmFreeFunction(op,tar,sig,mmC) == evalMmStack(mmC) == -- translates the modemap condition mmC into a list of stacks - mmC is [op,:a] and op in '(AND _and %and) => + mmC is [op,:a] and op in '(AND and %and) => ["NCONC"/[evalMmStackInner cond for cond in a]] - mmC is [op,:args] and op in '(OR _or %or) => + mmC is [op,:args] and op in '(OR or %or) => [:evalMmStack a for a in args] mmC is ['partial,:mmD] => evalMmStack mmD mmC is ['ofCategory,pvar,cat] and cat is ['Join,:args] => @@ -1180,7 +1180,7 @@ evalMmStack(mmC) == [[mmC]] evalMmStackInner(mmC) == - mmC is [op,:args] and op in '(OR _or %or) => + mmC is [op,:args] and op in '(OR or %or) => keyedSystemError("S2GE0016", ['"evalMmStackInner",'"OR condition nested inside an AND"]) mmC is ['partial,:mmD] => evalMmStackInner mmD @@ -1523,7 +1523,7 @@ hasCaty1(cond,SL) == -- SL is augmented, if cond is true, otherwise the result is 'failed $domPvar: local := NIL cond is ["has",a,b] => hasCate(a,b,SL) - cond is [op,:args] and op in '(AND _and %and) => + cond is [op,:args] and op in '(AND and %and) => for x in args while not (S='failed) repeat S:= x is ["has",a,b] => hasCate(a,b, SL) -- next line is for an obscure bug in the table @@ -1531,7 +1531,7 @@ hasCaty1(cond,SL) == --'failed hasCaty1(x, SL) S - cond is [op,:args] and op in '(OR _or %or) => + cond is [op,:args] and op in '(OR or %or) => for x in args until not (S='failed) repeat S:= x is ["has",a,b] => hasCate(a,b,copy SL) -- next line is for an obscure bug in the table @@ -1573,7 +1573,7 @@ hasSigOr(orCls, S0, SL) == atom cls => copy SL cls is ["has",a,b] => hasCate(subCopy(a,S0),subCopy(b,S0),copy SL) - cls is [op,:andCls] and op in '(AND _and %and) => + cls is [op,:andCls] and op in '(AND and %and) => hasSigAnd(andCls, S0, SL) keyedSystemError("S2GE0016", ['"hasSigOr",'"unexpected condition for signature"]) @@ -1592,9 +1592,9 @@ hasSig(dom,foo,sig,SL) == atom cond => copy SL cond is ["has",a,b] => hasCate(subCopy(a,S0),subCopy(b,S0),copy SL) - cond is [op,:andCls] and op in '(AND _and %and) => + cond is [op,:andCls] and op in '(AND and %and) => hasSigAnd(andCls, S0, SL) - cond is [op,:orCls] and op in '(OR _or %or) => + cond is [op,:orCls] and op in '(OR or %or) => hasSigOr(orCls, S0, SL) keyedSystemError("S2GE0016", ['"hasSig",'"unexpected condition for signature"]) @@ -1623,9 +1623,9 @@ hasAtt(dom,att,SL) == 'failed hasCatExpression(cond,SL) == - cond is [op,:l] and op in '(OR _or %or) => + cond is [op,:l] and op in '(OR or %or) => or/[(y:=hasCatExpression(x,SL)) ~= 'failed for x in l] => y - cond is [op,:l] and op in '(AND _and %and) => + cond is [op,:l] and op in '(AND and %and) => and/[(SL:= hasCatExpression(x,SL)) ~= 'failed for x in l] => SL cond is ["has",a,b] => hasCate(a,b,SL) keyedSystemError("S2GE0016", diff --git a/src/interp/i-map.boot b/src/interp/i-map.boot index 91f41976..85a4380f 100644 --- a/src/interp/i-map.boot +++ b/src/interp/i-map.boot @@ -422,7 +422,7 @@ simplifyMapPattern (x,alias) == sl:= getEqualSublis pred => y':= SUBLIS(sl,y) pred:= unTrivialize SUBLIS(sl,pred) where unTrivialize x == - x is [op,:l] and op in '(_and _or) => + x is [op,:l] and op in '(and or) => MKPF([unTrivialize y for y in l],op) x is [op,a,=a] and op in '(_= is)=> true x @@ -464,7 +464,7 @@ predTran x == x getEqualSublis pred == fn(pred,nil) where fn(x,sl) == - (x:= SUBLIS(sl,x)) is [op,:l] and op in '(_and _or) => + (x:= SUBLIS(sl,x)) is [op,:l] and op in '(and or) => for y in l repeat sl:= fn(y,sl) sl x is ["is",a,b] => [[a,:b],:sl] diff --git a/src/interp/nruncomp.boot b/src/interp/nruncomp.boot index 06448b37..d7407da3 100644 --- a/src/interp/nruncomp.boot +++ b/src/interp/nruncomp.boot @@ -712,12 +712,12 @@ genSlotSig(sig,$e) == [NRTgetLocalIndex t for t in sig] deepChaseInferences(pred,$e) == - pred is ['AND,:preds] or pred is ['and,:preds] => + pred is [op,:preds] and op in '(AND and %and) => for p in preds repeat $e := deepChaseInferences(p,$e) $e - pred is ['OR,pred1,:.] or pred is ['or,pred1,:.] => + pred is [op,pred1,:.] and op in '(OR or %or) => deepChaseInferences(pred1,$e) - pred is 'T or pred is ['NOT,:.] or pred is ['not,:.] => $e + pred is 'T or pred is [op,:.] and op in '(NOT not %not) => $e chaseInferences(pred,$e) vectorLocation(op,sig) == diff --git a/src/interp/nrunfast.boot b/src/interp/nrunfast.boot index 5ade3ee7..9a09fce0 100644 --- a/src/interp/nrunfast.boot +++ b/src/interp/nrunfast.boot @@ -653,8 +653,8 @@ newHasTest(domform,catOrAtt) == l is [ w1,['ATTRIBUTE,w2]] => newHasTest(w1,w2) l is [ w1,['SIGNATURE,:w2]] => compiledLookup(first w2,second w2, eval mkEvalable w1) newHasTest(first l ,second l) - pred = 'OR => or/[evalCond i for i in l] - pred = 'AND => and/[evalCond i for i in l] + pred in '(OR or %or) => or/[evalCond i for i in l] + pred in '(AND and %and) => and/[evalCond i for i in l] x null isAtom and constructor? op => domain := eval mkEvalable domform diff --git a/src/interp/nrungo.boot b/src/interp/nrungo.boot index 192d1128..59998333 100644 --- a/src/interp/nrungo.boot +++ b/src/interp/nrungo.boot @@ -246,11 +246,11 @@ lookupInCategories(op,sig,dom,dollar) == --======================================================= lookupPred(pred,dollar,domain) == pred = true => true - pred is ['AND,:pl] or pred is ['and,:pl] => + pred is [op,:pl] and op in '(AND and %and) => and/[lookupPred(p,dollar,domain) for p in pl] - pred is ['OR,:pl] or pred is ['or,:pl] => + pred is [op,:pl] and op in '(OR or %or) => or/[lookupPred(p,dollar,domain) for p in pl] - pred is ['NOT,p] or pred is ['not,p] => not lookupPred(p,dollar,domain) + pred is [op,p] and op in '(NOT not %not) => not lookupPred(p,dollar,domain) pred is ['is,dom1,dom2] => domainEqual(dom1,dom2) pred is ["has",a,b] => VECP a => diff --git a/src/interp/nrunopt.boot b/src/interp/nrunopt.boot index e584bdf3..a18db852 100644 --- a/src/interp/nrunopt.boot +++ b/src/interp/nrunopt.boot @@ -229,7 +229,7 @@ predicateBitIndex x == predicateBitIndexRemop p== --transform attribute predicates taken out by removeAttributePredicates - p is [op,:argl] and op in '(AND and OR or NOT not) => + p is [op,:argl] and op in '(AND and %and OR or %or NOT not %not) => simpBool makePrefixForm([predicateBitIndexRemop x for x in argl],op) p is ["has",'$,['ATTRIBUTE,a]] => LASSOC(a,$NRTattributeAlist) p @@ -276,12 +276,13 @@ augmentPredVector(dollar,value) == isHasDollarPred pred == pred is [op,:r] => - op in '(AND and OR or NOT not) => or/[isHasDollarPred x for x in r] + op in '(AND and %and OR or %or NOT not %not) => + or/[isHasDollarPred x for x in r] op in '(HasCategory HasAttribute) => first r = '$ false stripOutNonDollarPreds pred == - pred is [op,:r] and op in '(AND and OR or NOT not) => + pred is [op,:r] and op in '(AND and %and OR or %or NOT not %not) => "append"/[stripOutNonDollarPreds x for x in r] not isHasDollarPred pred => [pred] nil @@ -289,7 +290,7 @@ stripOutNonDollarPreds pred == removeAttributePredicates pl == [fn p for p in pl] where fn p == - p is [op,:argl] and op in '(AND and OR or NOT not) => + p is [op,:argl] and op in '(AND and %and OR or %or NOT not %not) => makePrefixForm(fnl argl,op) p is ["has",'$,['ATTRIBUTE,a]] => sayBrightlyNT '"Predicate: " diff --git a/src/interp/wi2.boot b/src/interp/wi2.boot index 3689f052..c5a6ef21 100644 --- a/src/interp/wi2.boot +++ b/src/interp/wi2.boot @@ -583,8 +583,8 @@ compMapCond''(cexpr,dc) == cexpr=true => true --cexpr = "true" => true ---------------> new <---------------------- - cexpr is [op,:l] and op in '(_and AND) => and/[compMapCond''(u,dc) for u in l] - cexpr is [op,:l] and op in '(_or OR) => or/[compMapCond''(u,dc) for u in l] + cexpr is [op,:l] and op in '(and AND) => and/[compMapCond''(u,dc) for u in l] + cexpr is [op,:l] and op in '(or OR) => or/[compMapCond''(u,dc) for u in l] ---------------> new <---------------------- cexpr is ["not",u] => not compMapCond''(u,dc) cexpr is ["has",name,cat] => (knownInfo cexpr => true; false) -- cgit v1.2.3