diff options
author | dos-reis <gdr@axiomatics.org> | 2011-02-13 14:28:30 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-02-13 14:28:30 +0000 |
commit | 75976e7d252b849c10767635baf27fb98af9a1b5 (patch) | |
tree | 1fe0b4053f96a8a8c0faec62311dbe197172881f /src/interp | |
parent | 7597a3e89739d29132c6b2f06563f8eb90799a74 (diff) | |
download | open-axiom-75976e7d252b849c10767635baf27fb98af9a1b5.tar.gz |
* interp/g-opt.boot (optCond): Get rid of double negatives when
possible.
* interp/g-util.boot (assumeProperty): Remove.
(flattenVMForm): Likewise.
(mkVMForm): Likewise.
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/g-opt.boot | 3 | ||||
-rw-r--r-- | src/interp/g-util.boot | 45 |
2 files changed, 3 insertions, 45 deletions
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index 65259fc3..08683f80 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -312,6 +312,9 @@ optCond (x is ['%when,:l]) == optCond ['%when,[['%or,p1,p2],:c1],['%otherwise,:c3]] x for y in tails l repeat + c := first c + if c is [['%not,['%not,p]],:.] then + c.first := p while y is [[a1,c1],[a2,c2],:y'] and EqualBarGensym(c1,c2) repeat a := ['%or,a1,a2] first(y).first := a diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot index 9ea6cca1..c96691e7 100644 --- a/src/interp/g-util.boot +++ b/src/interp/g-util.boot @@ -75,51 +75,6 @@ stringToChar s == s = '"\v" => $VerticalTab error strconc('"invalid character designator: ", s) ---% VM forms - -++ Make the assumption named `prop' for all symbols -++ on the lis `syms'. -assumeProperty(syms,prop) == - for s in syms repeat - property(s,prop) := true - -assumeProperty('(%and %or),'%nary) - -++ We are about to construct a middle end expression -++ with operator `op, and aguments `form'. Try to -++ simplify the structure of the expression. -flattenVMForm(form,op) == main where - main() == - atom form => form - EQ(form.op,op) => [op,:flatten(form.args,op,nil)] - [flattenVMForm(form.op,op),:flattenVMForm(form.args,op)] - flatten(forms,op,accu) == - forms = nil => accu - x := flattenVMForm(first forms,op) - cons? x and EQ(x.op,op) => flatten(rest forms,op,[:accu,:x.args]) - flatten(rest forms,op,[:accu,x]) - -++ Build a midde end expression with given operator and arguments. -mkVMForm(op,args) == - if op has %nary then - args := flattenVMForm(args,op) - op = '%or => - args := REMOVE('%false,args) - args = nil => '%false - args is [arg] => arg - [op,:args] - op = '%and => - args := REMOVE('%true,args) - args = nil => '%true - args is [arg] => arg - [op,:args] - op = '%not => - [arg] := args - arg = '%false => '%true - arg = '%true => '%false - arg is ['%not,arg'] => arg' - ['%not,:args] - ++ $interpOnly := false |