diff options
Diffstat (limited to 'src/interp/g-opt.boot')
-rw-r--r-- | src/interp/g-opt.boot | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index eceeae89..23648b53 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -105,7 +105,7 @@ changeVariableDefinitionToStore(form,vars) == jumpToToplevel? x == atomic? x => false op := x.op - op = 'SEQ => CONTAINED('THROW,x.args) -- FIXME: what about GO? + op is 'SEQ => CONTAINED('THROW,x.args) -- FIXME: what about GO? op in '(EXIT THROW %leave) => true or/[jumpToToplevel? x' for x' in x] @@ -175,15 +175,15 @@ resetTo(x,y) == ++ Simplify the VM form `x' simplifyVMForm x == - x = '%icst0 => 0 - x = '%icst1 => 1 + x is '%icst0 => 0 + x is '%icst1 => 1 atomic? x => x - x.op = 'CLOSEDFN => x + x.op is 'CLOSEDFN => x atom x.op => x is [op,vars,body] and op in $AbstractionOperator => third(x) := simplifyVMForm body x - if x.op = 'IF then + if x.op is 'IF then resetTo(x,optIF2COND x) for args in tails x.args repeat args.first := simplifyVMForm first args @@ -210,7 +210,7 @@ hasNoThrows(a,g) == hasNoThrows(first a,g) and hasNoThrows(rest a,g) changeThrowToGo(s,g) == - atom s or first s='QUOTE => nil + atom s or first s is 'QUOTE => nil s is ["THROW", =g,u] => changeThrowToGo(u,g) s.first := "PROGN" @@ -271,17 +271,17 @@ optCall (x is ['%call,:u]) == x.rest := [:a,name] x fn is [q,R,n] and q in '(ELT CONST) => - q = 'CONST => ['spadConstant,R,n] + q is 'CONST => ['spadConstant,R,n] emitIndirectCall(fn,a,x) systemErrorHere ['optCall,x] optCons (x is ["CONS",a,b]) == - a="NIL" => - b='NIL => (x.first := 'QUOTE; x.rest := ['NIL,:'NIL]; x) + a is "NIL" => + b is 'NIL => (x.first := 'QUOTE; x.rest := ['NIL,:'NIL]; x) b is ['QUOTE,:c] => (x.first := 'QUOTE; x.rest := ['NIL,:c]; x) x a is ['QUOTE,a'] => - b='NIL => (x.first := 'QUOTE; x.rest := [a',:'NIL]; x) + b is 'NIL => (x.first := 'QUOTE; x.rest := [a',:'NIL]; x) b is ['QUOTE,:c] => (x.first := 'QUOTE; x.rest := [a',:c]; x) x x @@ -292,20 +292,20 @@ optMkRecord ["mkRecord",:u] == ['%vector,:u] optCond (x is ['%when,:l]) == - if l is [a,[aa,b]] and aa = '%otherwise and b is ['%when,:c] then + if l is [a,[aa,b]] and aa is '%otherwise and b is ['%when,:c] then x.rest.rest := c if l is [[p1,:c1],[p2,:c2],:.] then if (p1 is ['%not,=p2]) or (p2 is ['%not,=p1]) then l:=[[p1,:c1],['%otherwise,:c2]] x.rest := l - c1 is ['NIL] and p2 = '%otherwise and first c2 = '%otherwise => + c1 is ['NIL] and p2 is '%otherwise and first c2 is '%otherwise => return optNot ['%not,p1] l is [[p1,['%when,[p2,c2]]]] => optCond ['%when,[['%and,p1,p2],c2]] l is [[p1,c1],['%otherwise,'%false]] => optAnd ['%and,p1,c1] l is [[p1,c1],['%otherwise,'%true]] => optOr ['%or,optNot ['%not,p1],c1] l is [[p1,'%false],['%otherwise,c2]] => optAnd ['%and,optNot ['%not,p1],c2] l is [[p1,'%true],['%otherwise,c2]] => optOr ['%or,p1,c2] - l is [[p1,:c1],[p2,:c2],[p3,:c3]] and p3 = '%otherwise => + l is [[p1,:c1],[p2,:c2],[p3,:c3]] and p3 is '%otherwise => EqualBarGensym(c1,c3) => optCond ['%when,[['%or,p1,optNot ['%not,p2]],:c1],['%otherwise,:c2]] EqualBarGensym(c1,c2) => @@ -348,7 +348,7 @@ optIF2COND ["IF",a,b,c] == optXLAMCond x == x is ['%when,u:= [p,c],:l] => - p = '%otherwise => c + p is '%otherwise => c ['%when,u,:optCONDtail l] atom x => x x.first := optXLAMCond first x @@ -358,7 +358,7 @@ optXLAMCond x == optCONDtail l == null l => nil [frst:= [p,c],:l']:= l - p = '%otherwise => [['%otherwise,c]] + p is '%otherwise => [['%otherwise,c]] null rest l => [frst,['%otherwise,["CondError"]]] [frst,:optCONDtail l'] @@ -383,7 +383,7 @@ optSEQ ["SEQ",:l] == null l => nil l is [["%LET",g,x],:r] and replaceableTemporary?(g,r) => getRidOfTemps substitute(x,g,r) - first l="/throwAway" => getRidOfTemps rest l + first l is "/throwAway" => getRidOfTemps rest l --this gets rid of unwanted labels generated by declarations in SEQs [first l,:getRidOfTemps rest l] SEQToCOND l == @@ -483,7 +483,7 @@ isSimpleVMForm form == ++ on the program point where it is evaluated. isFloatableVMForm: %Code -> %Boolean isFloatableVMForm form == - atom form => form ~= "$" + atom form => form isnt "$" form is ["QUOTE",:.] => true symbolMember?(form.op, $simpleVMoperators) and "and"/[isFloatableVMForm arg for arg in form.args] @@ -504,7 +504,7 @@ isVMConstantForm form == findVMFreeVars form == IDENTP form => [form] form isnt [op,:args] => nil - op = "QUOTE" => nil + op is "QUOTE" => nil vars := union/[findVMFreeVars arg for arg in args] atom op => vars union(findVMFreeVars op,vars) @@ -582,7 +582,7 @@ optLET u == body isnt [op,:args] => u -- Well, with case-patterns, it is beneficial to try a bit harder -- with conditional forms. - op = '%when => + op is '%when => continue := true -- shall be continue let-inlining? -- Since we do a single pass, we can't reuse the inits list -- as we may find later that we can't really inline into @@ -681,7 +681,7 @@ optCollectVector form == optRetract ["%retract",e,m,pred] == atom e => cond := simplifyVMForm substitute(e,"#1",pred) - cond = '%true => e + cond is '%true => e ["check-subtype",cond,MKQ m,e] g := gensym() ['%bind,[[g,e]],["check-subtype",substitute(g,"#1",pred),MKQ m,g]] @@ -690,23 +690,23 @@ optRetract ["%retract",e,m,pred] == --% Boolean expression transformers optNot(x is ['%not,a]) == - a = '%true => '%false - a = '%false => '%true + a is '%true => '%false + a is '%false => '%true a is ['%not,b] => b a is ['%when,:.] => optCond [a.op, :[[p,optNot ['%not,c]] for [p,c] in a.args]] x optAnd(x is ['%and,a,b]) == - a = '%true => b - b = '%true => a - a = '%false => '%false + a is '%true => b + b is '%true => a + a is '%false => '%false x optOr(x is ['%or,a,b]) == - a = '%false => b - b = '%false => a - a = '%true => '%true + a is '%false => b + b is '%false => a + a is '%true => '%true x optIeq(x is ['%ieq,a,b]) == |