Re: xml as intermediate representation



> [I agree that if you're going to pass stuff from phase to phase, XML
> is as good a way to do it as any because of all the tools. But I
> have my doubts about plug and play phases. The compilers I wrote
> depend on shared data structures like symbol tables, and if you're going
> to have independent phases, you're going to have to pass that shared
> data from phase to phase, too, greatly bulking up the process. -John]

There's quite a few things you can do without additional information,
depending on how the intermediate representation is structured. Things
like instrumenting function entry/exits for instance would require
only "local" information for many languages.

But even if you do need to pass additional information on, I'm not
sure it would be a problem. Note that I would not push for anyone
making XML the only way to pass information between phases, but as an
relatively simple way to be able to plug in functionality that
otherwise have a tendency to tie you closely in to both the compiler
writers preferred language and data model.

Having a command line switch to make the compiler stop after a
specific phase and dump data, or start at a specific phase and load
data would give a tremendous amount of flexibility, and for that XML
is suitable because of the large amount of tools that can help you
process that data.

Consider the amount of effort people have been willing to go through
(things like gcc-xml and OpenC++) to achieve what you'd get "for free"
if compilers were more likely to have good support for
serialising/deserialising part or all of their internal
representations.

If you're able to defer full integration of your tools into the
compiler proper until you know whether or not it'll be worth the
effort it significantly lowers the barrier to do interesting things...

Vidar
.



Relevant Pages

  • Re: next ISO/ANSI standard for C++
    ... > to XML widespread-ness, but mostly to the length of one's career, no? ... 3rd party libraries. ... Wouldn't it be good to just provide a standard ... The more the compiler has to decide, the less probable it is to ...
    (comp.lang.cpp)
  • XML-based object orientated pre-Assembler
    ... I have been promising an object orientated ASM IDE for a while now. ... Trying to make the best of what is already here, I have made a compiler, ... that will parse XML code and output ASM files. ...
    (alt.lang.asm)
  • Re: X Occurs 1 To 10 Times Depending On Y ??
    ... an ODO *never* (at least in any standard conforming) compiler ... impacts the amount of storage allocated - only the amount "currently ...
    (comp.lang.cobol)
  • Re: XML Comment Screwed - Possibly a bug in VB??
    ... What you probably wish for is a message that tells you what it really is that you are trying to do and how to do it, but that is impossible as the compiler can not guess what is on your mind. ... An ampersand is certainly allowed in an XML comment, but it has a special meaning. ... I don't have to send along a 42 page documentation of the file format, including what byte order and encoding to use, a description of the file structure, and how every single piece of information is arranged. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: xml as intermediate representation
    ... >> use xml as an intermediate representation language. ... For C I'd look at libxml for the XML parsing. ... and you could get that by writing a routine to dump the IR ... the format in the compiler. ...
    (comp.compilers)