From: Mushfeq Khan Date: 2007-02-22T13:33:04+09:00 Subject: Re: Parser as an alternative to RegExen ------=_Part_18828_10023569.1172118781314 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline If you're just looking to get the job done, you should stick with regexes. Your example doesn't look like it has the kind of expression constructs that would justify applying a full-fledged parser. On the other hand, if you have some time to kill or think your language could get a little more elaborate, then check out Dhaka by all means. :D It is still somewhat cumbersome since tokenizers have to be hand-written, but this is about to change. Mushfeq. On 2/21/07, Logan Capaldo wrote: > > On Thu, Feb 22, 2007 at 12:26:12PM +0900, James Edward Gray II wrote: > > On Feb 21, 2007, at 8:15 PM, 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. > > > > I really don't think there's any value in going all the way to a > > parser generator here. This job looks to be squarely in the Regexp > > domain, so there's no reason to feel bad about using them. > > > Agreed. > > OTOH, Parsers are sure fun to write! (esp. rec descent ones for simple > grammars). > > If you do decide to go with a parser generator, check out Dhaka, > http://dhaka.rubyforge.org/ > > > James Edward Gray II > > ------=_Part_18828_10023569.1172118781314--