[<<][meta][>>][..]
Fri Dec 30 12:28:25 EST 2011

Binary trees all the way down

It seems better to cut the knot and make Var support binary tree type
nested structures.  I.e. :

   a.car.cdr.cdr 

or

   a.m0.m1.m1

It seems that implementing StructRepr without these is quite
impossible.


So.. I run into a case where I need to destructure [a,b,c] into
car/cdr.  That doesn't work.  It looks like AStruct needs to be
binary.

Temporarily PrettyC.hs is broken because it needs support for nested
structs.

*** Exception: 
_uncons: RefCdr (Var {varType = Type (AStruct (Type AFloat 1,Type (AStruct (Type AFloat 1,Type AFloat 1)) 0)) 0, varName = "a0"})


Type (AStruct (Type AFloat 1,
               Type (AStruct (Type AFloat 1,
                              Type AFloat 1)) 0))


Aha.  The basic idea seems to be that this is about Var, not about
ref.  So RefCar becomes Ref (VarCar ...).


Seems to go ok.  Next problem is translating such a nested variable
into a proper dereferencing.

I.e. given  (VarCar (VarCdr ... (Var _ 1))) get the type

Jently down the stream..  I'm fixing PrettyC.hs following the
straightforward path guided by the types..  This is the first weird
error:

  *** Exception:
  cRefMem VarPair
   (Var {varType = Type AFloat 0, varName = "t1"})
   (VarPair (Var {varType = Type AFloat 0, varName = "t2"})
            (Var {varType = Type AFloat 0, varName = "t3"}))

Somebody is using a "virtual struct" as a reference.  If this is part
of an Unpack then that case should be handled also.

Yep.  This should be handled somewhere else, preferrably in Code so
that it doesn't need to be undone in PrettyC.


Hmm.. Maybe it's time for another unification: Write Lambda args in
terms of Var / VarPair etc..  That should make it simpler deal with
this Unpack (VarPair ...) business.



[Reply][About]
[<<][meta][>>][..]