Mr. Shawn H. Corey wrote: > Rob Dixon wrote: >> >> My example wasn't a nested one. It was just an example of two incorrect brace >> matches as the OP described them. > > You make it sound like I just discovered them and haven't been using > them for the past 30 years.
If you have been using state machine algorithms for thirty years then I am very surprised that you need to put it about in the way that a teenager would say that he was driving a BMW. I presumed you were in your early twenties and fresh out of a computer science degree. > Let's add some more data: This is what the OP posted. > __DATA__ > [correct] - correct > (also correct) - also correct > [wrong) - wrong > (also wrong] - also wrong And without knowing any criteria you have added these > (correct (and) nested) - correct, matches: (correct (and) > (wrong [and] nested) - wrong, matches: (wrong [and] > (correct [and) nested] - correct, matches: (correct [and) My example was simply [wrong) and (wrong] And then you say this > The problem is that the OP has specified a data format with nested > contexts, even though they may not realize it. If there are nested > context or the meaning of the symbols changes, it cannot be parsed with > just regular expressions; you need a FSA to parse it. If it has > unbounded recursion, you need a FSA with a push-down stack. The problem is that you have imagined the possibility of nesting. I wonder if you would have said the same thing if the symbols had been quotation marks? Also, 'push-down' is the only sort of stack that I know about, and the only distinction with unbounded recursion is that you need an unbounded stack. > The sad thing is that no-one teaches how to recognize the different > formats so the correct code can be written. I think the sad thing is that you see nails everywhere. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/