From: Ben Giddings Date: 2005-03-17T06:24:18+09:00 Subject: Re: Examples for racc? Jonathan Paisley wrote: > On Thu, 17 Mar 2005 04:43:50 +0900, Ben Giddings wrote: > If you use a regexp-based scanner as input to your parser, you may > actually end up with more regexp matching! True enough. I wasn't planning on using a regexp based scanner, but I'm not actually sure how some of these things are constructed internally. > I disagree with the statement that a regexp is essentially a complex > parser. As I understand it, parsers like racc describe a more complicated > language than that described by regular expressions. My understanding is that many regexp engines have complex parsers behind the scenes. In fact, with lookahead and such, regular expression syntax is much more complex than what bison can handle. I'm no regexp expert though, so I may be wrong about that. > Efficiency shouldn't be too much of a concern here anyway - the input data > rate is limited by how quickly your machine can do compilations - > certainly much slower than a few gsub!s on some very small input strings. Tis true. GCC can spit out a lot of output when it's dealing with small files, or doing dependency checks, but I imagine that's still slow compared to Ruby's regexp parsing speed. I may be engaging in premature optimization... Ben