[antlr-interest] how to solve 'code too large' problem?

scott at javadude.com scott at javadude.com
Fri Jul 13 13:03:17 PDT 2007


> On Friday 13 July 2007 11:32, scott at javadude.com wrote:
>> Huh? How is it not?
>
> Because you're talking about writing an ANTXR specification. My question
> was specifically about writing an ANTLR grammar for an XML document
> format.

98% of ANTXR is ANTLR. An ANTXR grammar is essentially a superset of an
ANTLR grammar.

> Yes, I see that. But you're not addressing the question I asked: Why
> would someone write an ANTLR grammar for an XML document format?

With ANTXR existing, I would say noone should write an ANTLR grammar for
XML ;)

Grammar-based XML parsing (whether ANTLR or ANTXR) can be very effective
for some XML parsing tasks. If you're just reading something from XML into
a pretty-direct object structure, then it's not a good solution (and some
of the tools you've pointed out are better suited.)

If the structure you want to read into doesn't match the xml structure, or
if you want to "execute" the xml, or if you don't plan to store all of the
data, a grammar-based solution can be much easier to maintain.

-- Scott


More information about the antlr-interest mailing list