Instead of having one parser for code and another for serialization, how about using the generic serialization mechanism to read in the parse tree? The biggest problem with this is that the parse "tree" can now be a graph. If it has recursive/circular references it could really confuse the loader. It's ok to have arbitrary graphs as initialization objects (great, even!). It's just the code portion of the parse tree that this is non-sensical for. If the first stage tree walker for the parse tree keeps a stack of visited nodes and aborts if it encounters a node already on the stack that should take care of it. Note: only check every N nodes, and then only if the stack depth is greater than M. The result can then be interpreted as a tree even if (for example) common pieces of code are only output once, with multiple usages pointing to the same section of parse tree. As the code generator operates, it produces trees with multiple occurances of such common code. Each occurance can be optimized separately, but they can all refer back to the common parse tree elements. Debugging info then contains pointers into the parse tree. Is there any way to stop the generic de-serializer from reading the debugging info in if you're not interested in it? "here's a serialized array. give me the first three elements, then stop parsing" Don't overburden Array with this functionality. Either it's a special object type which can appear anywhere in the stream, or it can only appear at the top level of the stream. Does it make sense to allow this anywhere *other* than at the top level? If it's burried, the parser will have to parse and discard it. So: the serializer has two calls: SerializeOneObject(Object) and SerializeMultipleObjects(Array). The deserializer also has two calls: Object DeserializeOneObject() and Array DeserializeMultipleObjects(). If a OneObject serialized stream is read with DeserializeMultipleObjects, you get an array with the first element being the object. If a MultipleObjects serialized stream is read with DeserializeOneObject, you just get the first object and the rest of the stream is discarded. SerializeOneObject just creates a one element array and serializes that.