[antlr-interest] RFC syntax extractor/convertor

M. Rangnathan mranga at nist.gov
Tue May 9 02:40:01 PDT 2006


I realise I am posting to a group of antlr fans so excuse me for posting 
a frank *opinion*.

I have found direct hand parsing of RFC syntax to be the best 
alternative. Antlr generates a huge amount of  inefficient code for this 
purpose. For example, I tried to convert the sip grammar into an antlr 
parser. The syntax of antr rules make it appear to be straightforward 
but one quickly runs into trouble. By the time I got done, there were so 
many "semantic" lookaheads ( read "hacks" ) necessary for the purpose 
that I finally gave up the approach (after having actually succeeded in 
building the parser) and wrote a hand parser for the whole thing. It ran 
a lot faster and was a lot smaller.

Lesson learned: RFC syntax is generally not amenable to automatic parser 
generation because it does not conform to normal LALR or LL1 constraints 
(tends to be rather free form). It winds up being context sensitive, 
ncessitating the use of semantic lookahead and other tricks. A real 
mess. On the other hand, it was not too hard to write a hand parser. I 
actually looked at the code outputted by antlr and used it as a guide.

Regards,

Ranga

Liu Detang wrote:

> Hi
>
> Is there any RFC syntax extractor (convertor to ANTLR grammar)?
>
> Thanks,
> Detang
>
>
>


-- 
M. Ranganathan 

Advanced Networking Technologies Division,
National Institute of Standards and Technology (NIST),
100 Bureau Drive, Stop 8920, Gaithersburg, MD 20899. 
tel:301 975 3664 , fax:301 590 0932 http://w3.antd.nist.gov/
Advanced Networking Technologies For the People!  




More information about the antlr-interest mailing list