Tim --

Consider the following line (extracted from src/interp/wi2.boot)

    ['SEQ,:l,['exit,1,x]] := item

This requires pattern matching, in particular, that the object denoted
by "item" has the structure implied by the left hand side.  This
particular construct is handled in bootsys by the routine bfLET
(src/boot/tytree1.boot), and more precisely by bfLET2 which I
reproduce below.  

Currently, the above will produce an error with bootsys, but not with
depsys (which is the old Boot translator).  The error is not that of
syntax issue, but that of a bug lurking in bfLET2.  

When bfLET2 proceeds decomposing the left hand side, it eventually
comes to  

    ['exit,1,x] := t1

where t1 is identifier I just invented for the purpose of the
presentation.  Then, bfLET2 does not know what to do with the literal
"1" that appears on the left hand side, therefore errors out.  It
appears that the code that handles that part has been commented out
(and replaced by call to bpTrap which is wrong as we're at the
semantics processing phase, not parsing), with no explanation.
Indeed, the assignment 

        ['exit,1,x] := t1

is semantically equivalent to

        t1 is ['exit,1,x]

Do you remember having commented that part out and if so why?

-- Gaby

bfLET2(lhs,rhs) ==
  IDENTP lhs => bfLetForm(lhs,rhs)
  NULL lhs   => NIL
  lhs is ['FLUID,.] => bfLetForm(lhs,rhs)
  lhs is ['L%T,a,b] =>
    a := bfLET2(a,rhs)
    null (b := bfLET2(b,rhs)) => a
    ATOM b => [a,b]
    CONSP CAR b => CONS(a,b)
    [a,b]
  lhs is ['CONS,var1,var2] =>
    var1 = "DOT" or (CONSP(var1) and EQCAR(var1,'QUOTE)) =>
      bfLET2(var2,addCARorCDR('CDR,rhs))
    l1 := bfLET2(var1,addCARorCDR('CAR,rhs))
    null var2 or EQ(var2,"DOT") =>l1
    if CONSP l1 and ATOM CAR l1 then l1 := cons(l1,nil)
    IDENTP var2 =>
      [:l1,bfLetForm(var2,addCARorCDR('CDR,rhs))]
    l2 := bfLET2(var2,addCARorCDR('CDR,rhs))
    if CONSP l2 and ATOM CAR l2 then l2 := cons(l2,nil)
    APPEND(l1,l2)
  lhs is ['APPEND,var1,var2] =>
    patrev := bfISReverse(var2,var1)
    rev := ['REVERSE,rhs]
    g := INTERN CONCAT('"LETTMP#", STRINGIMAGE $letGenVarCounter)
    $letGenVarCounter := $letGenVarCounter + 1
    l2 := bfLET2(patrev,g)
    if CONSP l2 and ATOM CAR l2 then l2 := cons(l2,nil)
    var1 = "DOT" => [['L%T,g,rev],:l2]
    last l2 is ['L%T, =var1, val1] =>
      [['L%T,g,rev],:REVERSE CDR REVERSE l2,
       bfLetForm(var1,['NREVERSE,val1])]
    [['L%T,g,rev],:l2,bfLetForm(var1,['NREVERSE,var1])]
  lhs is ["EQUAL",var1] =>
    ['COND,[["EQUAL",var1,rhs],var1]]
  bpSpecificErrorHere '"unexpected  LET code is generated in this line"
  REALLYPRETTYPRINT lhs
  bpTrap()

--  -- let the IS code take over from here
--  REALLYPRETTYPRINT lhs
--  isPred :=
--    $inDefIS => bfIS1(rhs,lhs)
--    bfIS(rhs,lhs)
--  REALLYPRETTYPRINT ['COND,[isPred,rhs]]
--  ['COND,[isPred,rhs]]


_______________________________________________
Axiom-developer mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-developer

Reply via email to