From: David Vallner Date: 2007-02-22T19:33:44+09:00 Subject: Re: Parser as an alternative to RegExen On Thu, 22 Feb 2007 03:15:09 +0100, S. Robert James wrote: > I'm parsing a large file, currently using compound regexen: > > PREAMBLE = 'AA' > USERID = '\d{8}' > USER_HELLO = "#{PREMABLE}(#{USERID})" > > Is there a simple way to do this using a parser such as ANTLR? I've > never used one before, so if it requires a learning curve, I'll stick > to my regexen. > > But if there is a cleaner way to do this, I'd certainly like to. > > One instance where I'd be thinking of picking up parser-fu would be if the data contains recursively nested structures of some sort. Either the regexes, or the ancillary code juggling them gets hairy anyway, losing you the simplicity, and you still have to work your way through the nesting levels manually, which an AST parser would do for you. David Vallner