[antlr-interest] ANTLR3 tutorial

Thomas Brandon tbrandonau at gmail.com
Thu Aug 3 02:10:05 PDT 2006


On 8/3/06, Martin Probst <mail at martin-probst.com> wrote:
> Hi,
> Third, and if you really know what you are doing (ie. have spent
> years on XML and have a very specific case in which everything is
> different. This is almost certainly not you, whoever might read
> this :-) ), then don't start by writing an XML lexer, but rather use
> an existing one, e.g. any SAX parser you like. Then use that one as
> the lexer, convert the events to tokens, and implement the
> appropriate ANTLR interface.

Or check out ANTXR (http://www.javadude.com/tools/antxr/index.html)
(by Scott Stanchfield) which implements Antlr over a SAX backend as
you describe. I think you are correct though that you should be
careful that this is a better method than the many available binding
methods. But I think there are some cases where this is warranted. If
you have a more complicated schema (constraints not expressible in an
XSD would be the ultimate example) that doesn't map so easily to the
object model you want for instance. And if you want to support
multiple languages then this seems as good a candidate as any other
proprietary binding mechanism.

Tom.
>
> Martin


More information about the antlr-interest mailing list