In message <[EMAIL PROTECTED]>
Dan Sugalski <[EMAIL PROTECTED]> wrote:
> Is there any reasonable case where we would need to backtrack over
> successfully parsed source and redo the parsing? I'm not talking about the
> case where regular expressions run over text and ultimately fail, but
> rather cases where we need to chuck out part of what we have and restart?
That's effectively analogous to asking how much lookahead you need
to have, and the answer to that is that it depends entirely on the
grammar you're trying to parse.
With infinite lookahead you would never need to backtrack as you
could, if necessary, look right to the end of the program to decide
what the next token meant. Equally with no lookahead you will quite
likely need to backtrack unless your grammar is fairly restrictive, and
we all know that perl's grammar is anything but restrictive ;-)
Tom
--
Tom Hughes ([EMAIL PROTECTED])
http://www.compton.nu/
...Lonely men seek companionship. Lonely women sit at home - they never meet.