From a1eeda981dd4d753a805ff4a13a4ef26d167a7fb Mon Sep 17 00:00:00 2001 From: dos-reis Date: Mon, 31 May 2010 20:35:23 +0000 Subject: * interp/compiler.boot (compWithMappingMode): Handle lambda expressions as mapping. --- src/interp/compiler.boot | 1 + src/interp/g-opt.boot | 4 ++-- src/interp/g-util.boot | 14 +++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src/interp') diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index 6bad4fcb..0fd20551 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -360,6 +360,7 @@ compWithMappingMode(x,m is ["Mapping",m',:sl],oldE) == if get(x,"modemap",$CategoryFrame) is [[[.,target,:argModeList],.],:.] and (and/[extendsCategoryForm("$",s,mode) for mode in argModeList for s in sl] ) and extendsCategoryForm("$",target,m') then return [x,m,e] + x is ["+->",:.] => compLambda(x,m,oldE) if string? x then x:= INTERN x for m in sl for v in (vl:= take(#sl,$FormalMapVariableList)) repeat [.,.,e]:= compMakeDeclaration(v,m,e) diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index bf094be5..953efd3f 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -404,9 +404,9 @@ $VMsideEffectFreeOperators == MINUSP GREATERP ZEROP ODDP FLOAT_-RADIX FLOAT FLOAT_-SIGN FLOAT_-DIGITS CGREATERP GGREATERP CHAR BOOLE GET BVEC_-GREATER FUNCALL %false %true %and %or %not %eq %ieq %ilt %ile %igt %ige %head %tail %integer? - %imul %iadd %isub %igcd %ilcm %ipow %imin %imax %ieven? %iodd? + %imul %iadd %isub %igcd %ilcm %ipow %imin %imax %ieven? %iodd? %iinc %feq %flt %fle %fgt %fge %fmul %fadd %fsub %fexp %fmin %fmax - %fpow %nil %pair?) + %fpow %nil %pair? %lconcat %llength %hash %ismall?) ++ List of simple VM operators $simpleVMoperators == diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot index 5e1a228a..6d19f0dd 100644 --- a/src/interp/g-util.boot +++ b/src/interp/g-util.boot @@ -255,12 +255,14 @@ for x in [ ['%ineg, :"-"], ['%integer?,:'INTEGERP], ['%iodd?, :'ODDP], + ['%ismall?, :'FIXNUMP], -- binary integer operations. ['%iadd,:"+"], ['%ieq, :"EQL"], ['%igcd,:'GCD], ['%ige, :">="], ['%igt, :">"], + ['%iinc,:"1+"], ['%ilcm,:'LCM], ['%ile, :"<="], ['%ilt, :"<"], @@ -287,9 +289,15 @@ for x in [ -- list contants -- ['%nil, :'NIL], -- unary list operations - ['%head,:'CAR], - ['%pair?, :'CONSP], - ['%tail,:'CDR] + ['%head, :'CAR], + ['%llength, :'LIST_-LENGTH], + ['%pair?, :'CONSP], + ['%tail, :'CDR], + -- binary list operations + ['%lconcat, :'APPEND], + + -- general utility + ['%hash,:'SXHASH] ] repeat property(first x,'%Rename) := rest x ++ Table of opcode-expander pairs. -- cgit v1.2.3