6 ms·
Everything is an object that is either a cons cell or an atom. Associate the address of each object with a unique index. Serialize each object as a pair (index
by aportnoy 3y ago
Everything is an object that is either a cons cell or an atom. Associate the address of each object with a unique index.
Serialize each object as a pair (index, obj), where 'index' maps back to the original address where the object was stored, and 'obj' is a pair of indices if the object is a cons cell, or the appropriate representation (string literal, integer, etc.) if the object is an atom.
Then to deserialize allocate a memory location for every index and load the objects as is. Then replace the indices with the corresponding (new) addresses.
- aportnoy 3y agoThis definitely isn't "printing" in the original sense, just a serialization algorithm.