[antlr-interest] XML transformation support for 3.0

Oliver Zeigermann oliver at zeigermann.de
Mon Aug 9 00:13:02 PDT 2004


Terence Parr wrote:

> On Aug 7, 2004, at 7:03 AM, Oliver Zeigermann wrote:
> 
> 
>>Folks!
>>
>>ANTLR 3.0 seems to actually make it and I am looking forward to it. It
>>was once discussed to add XML transformation support to ANTLR. If
>>Terence and the rest of the ANTLR community still are interested I can
>>help with that.
>>
>>I have added XML transformation support to 2.x and it turned out to be 
>>a
>>very poweful, yet a bit less convenient alternative to XSLT.
>>
>>Now, as ANTLR 3.0 might allow interpreted *and* compiled parsing and -
>>if things go well ;) - will allow for a standard syntax for AST
>>construction etc. it will suit nearly perfect for XML transformations.
>>The interpreted thing with only standard syntax for AST creation for
>>simply ad hoc transformations and the compiled version for complex and
>>performance critical stuff.
> 
> 
> Hi,
> 
> I hope to make ANTLR's trees be XML compatible or compliant or 
> convertible etc... (there is an unfortunately method naming/return type 

Not sure if we talk about the same thing here. Are you talking about 
ASTs supporting DOM interfaces or such? Why that? I'd say do not bother 
about compatibility with XML APIs. If someone wants DOM simply let him 
write an adapter. If someone wants PDOM? Same thing...


> issue). XML is just a tree so I expect to support XML transformations 
> in that sense.  You'll never see anything like xpath or whatever come 
> from me, however....What kind of transformations were you thinking 
> about?

Of course you can easily transform *generic* XML without any problem, 
but also without the most benefit. In generic XML you would have token 
types like "start element", "end element" and "text".

To make use of the full power of ANTLR you would have to have a token 
type for *each* element possible in the XML to transform. This is a bit 
harder to do, but leads to great (and I repeat myself *great*) 
transaformation power both in obviousness and brevity of code certainly 
unmatched by XSLT or any other XML/SGML transformation language I can 
across.

If desired I can give an example how a generic and a specific grammar 
would look like, omitted it here to keep the post small...

> For sure, we should have a standard XML parser and generator, though, 
> right?

Standard XML parsers can interface to SAX, DOM and some to a new 
straming API. Would be best to interface ANTLR to all of them. Would be 
great if we not only had it interface to ASTs, but also to token 
streams. I can go into detail if anyone is interested.

Oliver


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list