jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bertrand Delacretaz" <bdelacre...@apache.org>
Subject Re: master plan for jsr 283 query implementation
Date Wed, 12 Sep 2007 06:32:06 GMT
Hi Thomas,

Thanks for the clarifications (and sorry for my somewhat ironic
statement about you being the only one wanting a hand-written parser,
but you kind of called for that ;-)

On 9/11/07, Thomas Mueller <thomas.tom.mueller@gmail.com> wrote:
> ...I have used JavaCC, ANTLR, and made hand-written parsers. Hand-written
> parsers are more flexible:...

Agreed, if you write it yourself you can do whatever.

> ...Many people think that hand-written parsers are hard to read, I don't think so:
>
> ...Java:
> private Expression readAnd() throws ParseException {
>     Expression r = readUnary();
>     while (readIf("AND")) {
>         r = new AndExpression(r, readUnary());
>     }
>     return r;
> }

Cool - very readable indeed.

Just curious, don't you use use a separate tokenizing step in your
hand-written parsers (I'm asking because of the literal "AND" above)?

I usually prefer a separate tokenizing step, if only to make testing
easier. Is this due to the context-sensitive tokenizing that you
mention?

> > ...I think there is time better spent doing other things than writing parsers :-)
> I agree, if writing the parser yourself actually takes more time than
> using JavaCC. In my view, it doesn't, but this is just my opinion...

The final answer to this question is probably "whoever implements it
gets to decide". For me, the easiest way to understand a parser would
be the unit tests which demonstrate its functionality, anyway.

-Bertrand

Mime
View raw message