[Swift-devel] intermediate XML

Mihael Hategan hategan at mcs.anl.gov
Sat Apr 18 00:42:02 CDT 2015


Hi,

Yes. I made some progress in that direction, but other things eventually
got in the way and I stopped working on it.

In the mean time, we do have to work with the existing parser.

Mihael

On Sat, 2015-04-18 at 00:38 -0500, Michael Wilde wrote:
> Mihael,
> 
> Weren't you at one time looking into using the Swift/T parser for Swift/K?
> 
> Or the Swift/T ANTLR grammar?
> 
> I thought this was at least mentioned in a Swift team meeting.
> 
> - Mike
> 
> 
> On Fri, Apr 17, 2015 at 11:31 PM, Tim Armstrong <tim.g.armstrong at gmail.com>
> wrote:
> 
> >  Makes sense to me if it simplifies the code - I'm not sure how much
> > ongoing maintenance overhead it is to keep up the additional
> > transformations.
> >
> >  - Tim
> >
> > On 17 April 2015 at 22:18, Mihael Hategan <hategan at mcs.anl.gov> wrote:
> >
> >> 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
> >>
> >> _______________________________________________
> >> Swift-devel mailing list
> >> Swift-devel at ci.uchicago.edu
> >> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel
> >>
> >
> >





More information about the Swift-devel mailing list