On Tue, 28 Jun 2005, Werner LEMBERG wrote:
> Hmm, I wonder whether it makes sense to have two parser runs instead
> of lexer + parser -- doing this should avoid the complications. In
> general, is the parser much slower than the lexer? Are there any
> timings?
The lexer uses a linear-time algorithm. The parser is "usually"
linear-time but can be much worse.
> But if you have recursive rules the results are loooong regexps with
> many repetitive elements -- nothing for the faint-hearted.
The lexer spec file lets you define named regular expressions
to make it simpler to use many repeted sub-expressions.
Can you provide an example of what you are trying to do that
would be hard to do in the lexer spec file?
> BTW, it
> would be great if there existed a kind of `extended' regexp mode
> (similar to Python) which ignores whitespace so that I can break the
> lines at suitable points.
Define smaller phrases of your regular expression in the
definitions section.