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

Randall R Schulz rschulz at sonic.net
Fri Jul 13 11:53:16 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.


> You're writing a grammar for your xml file.

A grammar, yes. But not an ANTLR grammar.


> You could write an XMI grammar quite easily.
>
> ANTXR saves you from having to write a lexer and adds some
> convenience syntax for attributes and xml-rule names.

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?


> I know about the other XML parsers that you mention; it depends on
> what you want to do with the xml. If you're just mapping xml to
> objects, they'll work well. And DOM is just gross...

There are better and worse document object models. I've used XOM, which 
is much cleaner than the W3C DOM.


> -- Scott
>
> > Well, that's not really writing a parser for an XML document in
> > ANTLR, is it? It's interesting and novel and probably good for some
> > uses, but the case in point was someone writing a purpose-built
> > ANTLR parser for XMI specifically.
> >
> > Also, there are other approaches that are not big chains of
> > if-then-else tests or Digester rules. There are several DOM (-like)
> > APIs, e.g. as well as JiBX, JAXB, etc.


Randall Schulz


More information about the antlr-interest mailing list