[Swift-devel] intermediate XML

Mihael Hategan hategan at mcs.anl.gov
Fri Apr 17 22:18:43 CDT 2015


Hi,

I think we should remove the intermediate XML (aka. swiftx).

It was initially meant to be an abstract representation (like Java
bytecode) so that multiple backends could be implemented easily.
However, the reality is that the XML is a direct representation of the
swift/K parse tree. The other reality is that the only potential place
that could have used this as intended (swift/T) didn't. 

Here's what happens in the code:

1. swift parser parses the .swift code and generates a representation of
the parse tree as StringTemplate objects. 

2. the StringTemplate tree gets serialized to XML using swiftscript.stg
(a template collection). This gets saved to disk.

3. XML beans are generated from the schema and the generated XML is
loaded into a tree of XML Beans.

4. The Karajan class traverses the XML Beans tree and generates karajan
code (using StringTemplate objects).

I think that everything between steps 1 and 4 is just Rube Goldberg
code. It translates the same data structure between StringTemplate to
XML to XML Beans. It could all (easily I might add) be replaced with
nice Java classes representing the parse tree.

Opinions?

Mihael




More information about the Swift-devel mailing list