in reply to What does it mean that a "pattern cannot be reversed?"
The only alternative is to reparse the string from the beginning (or from somewhere earlier in the string) and see if you happen to come out to the same place. This strikes me like one of those super-inefficient sorting algorithms where you shuffle the elements into a random order and then check to see if you happened to get them in order this time. If not, try a different guess. The intent of the verbiage in the synopsis is to rule out such a guessing implementation, which people tend to fall into because the notion of reversing the syntax tree is rather exotic until you think about it a while. But tree reversal is the right way to do it in a backtracking rule engine, so that's how Perl 6 will do it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What does it mean that a "pattern cannot be reversed?"
by tphyahoo (Vicar) on Jan 07, 2005 at 13:28 UTC |