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

Randall R Schulz rschulz at sonic.net
Fri Jul 13 10:11:13 PDT 2007


On Friday 13 July 2007 09:09, scott at javadude.com wrote:
> Check out antxr: http://javadude.com/tools/antxr.
>
> I tweaked ANTLR 2 to accept some xml-ish syntax and created
> tokenstreams that use SAX or XMLPull to read tokens. I've been using
> it for all of my xml parsing and it's so much easier than writing big
> if statements in a startElement method or setting up rules in
> digester.

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.


By the way, you might want to consider implementing ANTXR as a 
pre-processor that produces an ANTLR grammar rather than having to 
modify ANTLR itself.


> Later,
> -- Scott


Randall Schulz


> > On Friday 13 July 2007 07:36, Chaudhari, Pranita, OPEE14 wrote:
> >> Hello,
> >>
> >> I am using Antlr V3 for writing grammar to parse UML Model
> >> (exported to XMI).
> >
> > I have not been able to think of a reason to write an ANTLR parser
> > for an XML document format.
> >
> > Can someone help me see why one would not use one of the existing
> > XML parsers and other XML-based tools when dealing with XML
> > documents?


More information about the antlr-interest mailing list