
At 22:36 2003-01-23 -0800, Darius Bacon wrote:
Bengt Richter <bokr@oz.net> writes:
I have some thoughts for decribing C structures (and anything else digital) in a canonical abstract way. I'll call such a decription a meta-representation, and a function that produces it from a Python object is meta_repr(python_object) => meta_rep_obj. The reverse operation is meta_eval ;-)
The basis for meta_repr is that it capture and meta-represent (type, id, value) for an object in a pure abstract form. The abstract basis for storing the information is a bitvector object with attribute names that specify slices of the bitvector. I.e., there is an effective dict like {'slicename':(lo,hi)} and __getattr__ uses it so that bvec.slicename refers to bvec[lo:hi] etc. This is pure and abstract data, but you can see that interpreted little-endianly you can very straightforwardly lay out a C struct with whatever field widths and alignments you want.
Sounds vaguely like this paper:
First-Class Data-type Representation in SchemeXerox http://citeseer.nj.nec.com/4990.html
Darius
Thank you for the reference! I can see why you were reminded. Regards, Bengt