[jdom-interest] XPath Parsing

Patrick Dowler Patrick.Dowler at nrc.ca
Fri Jul 7 09:11:00 PDT 2000

I once needed a simple parser and used CUP to generate it. 
CUP is free, small, and produces an LALR parser from a
single grammar file of more or less standard syntax. You get
to easily supply scraps of code in the grammar file that get
used by the generated parser.

On Thu, 06 Jul 2000, bob wrote:
> > 1) What's the redistribution license for antlr.jar?
> 	Public Domain

CUP is under its own very free license. The URL is


The same page also refers to JLex, which I haven't tried.

> > 2) How large is antlr.jar?
> 	937 k.

The runtime is very small (3 classes, 7k)!!

> > 3) How hard is it to work without antlr.jar?
> 	antlr.jar is basically lex/yacc for Java.  Sure, you
> 	can hand-write a parser.  But no one really wants to
> 	do that.

Since I don't know anything about XPath (and not much about LALR parsers
for that matter :-) I can't say how hard it would be to write an XPath
parser using CUP...

Patrick Dowler
Canadian Astronomy Data Centre

More information about the jdom-interest mailing list