[antlr-interest] Re: Antlr noobie, nondeterminism abounds

Mark Lentczner markl at glyphic.com
Tue May 11 08:28:25 PDT 2004


Wes -

> Mark, I couldn't quite tell from your reply if you thought that maybe
> a lexer/parser is the wrong tool for the job in this case:
> ...
> Is this using a hammer when a screwdriver is what's needed?  My
> project is to parse IMAP server replies (formatting the requests isn't
> too difficult), so it's not a necessity that it be done in a
> parser-generator if that's not the right avenue to take.

Well, I can't say it is a clear answer one way or the other!  For most 
internet protocols I'd think that a generated parser is in appropriate: 
  They generally have very few reused or recursive structures, need 
almost no parsing look ahead, have irregular and context sensitive 
token definitions, and all-in-all aren't that big.  For example, I 
don't think parser would really help parsing HTTP headers.
------
I wrote a long Aside here, but decided to post it to my blog instead:
     http://www.ozonehouse.com/mark/blog/code/ParseProgProto.html
------
IMAP, however, is bear: It is big and complex, structurally highly 
irregular, yet some structures are reused and look ripe for parsers.  
On the other hand, as we've discussed, the character level is not very 
amenable to tokenizing.

Sure, I might use a grammar for IMAP responses - but I probably 
wouldn't build and AST, and instead generate my own response structures 
directly in the parser actions.  I think I'd have to do most of the 
work in the parser, and leave the lexer to only pass on characters.

	- Mark



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list