directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <>
Subject Antlr or simple code for parsing DN ?
Date Fri, 04 Feb 2005 19:31:18 GMT

just a question : is it really necessary to use a tool like antlr to
parse a grammar that can be parsed "by hand" ?

I mean, there are many problems to parse this kind of grammar (DN) with
antlr due to the LL(k) lexer. LL(k) grammars are GOOD, but it leads to
many tricky adjustment if applied to a lexer.

As seen with Alan, a DN string may be very harsh to parse, and must be
"normalized" to allow comparisons. But normalization should occur at the
lexer level - correct me if I'm wrong -, not at the parser level, if the
normalization process only means "lowercasing" hex values and
"octothorping" of oid values (sorry for those horrible neologisms )

Thus, it costs time, and energy to fix this grammar and let it accepts
any kind of valid AND invalid strings. 

At which point do we have to consider that it costs more than having a
Java parser hand written? (including maintenance costs, of course).

For instance, g files used to parse DNs are 400 lines long actually. My
own private DN parser which I wrote 2 weeks ago - way before I knew that
Apache DS was given half-life - is 700 lines long.

What do you think ?

(of course, my -almost- total ignorance of antlr suggest me to write
message ;-)


View raw message