diff options
-rw-r--r-- | src/ChangeLog | 8 | ||||
-rw-r--r-- | src/interp/g-opt.boot | 3 | ||||
-rw-r--r-- | src/interp/g-util.boot | 45 |
3 files changed, 11 insertions, 45 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 15a1634e..b7e63e94 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2011-02-13 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * interp/g-opt.boot (optCond): Get rid of double negatives when + possible. + * interp/g-util.boot (assumeProperty): Remove. + (flattenVMForm): Likewise. + (mkVMForm): Likewise. + 2011-02-12 Gabriel Dos Reis <gdr@cs.tamu.edu> * interp/compiler.boot (compCons1): Use coerce not convert. 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 |