Re: Re: software design clarification
Stefan Seefeld <[email protected]> Tue, 01 May 2007 13:39:57 -0400
| Newsgroups | gmane.comp.documentation.synopsis |
|---|---|
| Message-ID | <[email protected]> |
Eric M. Hopper wrote:
> On Mon, 2007-04-30 at 23:30 +0200, Markus Elfring wrote:
>>> (However, I can't resist pointing out that I very strongly believe XML to be
>>> the wrong tool for the job. See http://www.rdb.com/demo/XML/ for why.)
>> I like the rant by Graydon Hoare, too. I guess that a least common
>> denominator will be a kind of DOM API if you prefer binary formats for
>> internal tree processing.
>> http://en.wikipedia.org/wiki/Document_Object_Model
>
> So, why is XML a bad format for representing parse trees? The worst
> thing about it that I can see is that parse trees have references to
> identifiers that are described by other parse trees, and so the document
> would have a bunch of internal pointers in it.
It may not be that bad as a storage format (Markus was asking for an in-memory
representation he could apply XPath queries to). The only immediate argument
that comes to mind is its verbosity (as usual).
Parse trees don't have references, usually (or else they weren't trees, but graphs).
References need to be created externally when interpreting a parse tree.
> What reasons are there against XML in the specific case of ASTs? It's
> really great to point at a general rant that I largely agree with, but
> do you have anything more concrete?
Same as above. We are talking about in-memory representations, and there the XML-way
of doing things would be a DOM, which, I think, is hugely inappropriate. (Even more
so than with XML itself. :-) )
Right now the AST is stored on disk as a python pickle. That's mostly for convenience,
because that is what Python supports out of the box. It's possible to get inventive
and to consider alternative formats (for which writers and readers would need to be written.
As Graydon points out, XML only provides the lowest layer. You'd still need to reconstruct
the AST from the incoming XML data. That code doesn't exist.)
Again, so far I haven't had any need to dive into that. There are much more important issues
to be solved.
Regards,
Stefan
--
...ich hab' noch einen Koffer in Berlin...