Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Parse versus Regular Expressions

From: g:santilli:tiscalinet:it at: 5-Apr-2003 21:27

Hi Joel, On Saturday, April 5, 2003, 4:40:01 PM, you wrote: JN> Before we get too far down this road (and have to backtrack ;-), let JN> me state clearly that I'm not agitating for PARSE to be redesigned. JN> I am simply suggesting that each paradigm has its own "sweet spot". I know that, however, we should not ignore the underlying complexity of the tools we use. Sometimes is a blessing to have some nice abstracted layer over everything, sometimes it is a disaster. Most of the times, things can be automated efficiently; but there are cases where you expect the computer to do the right thing, but it doesn't. (As an example, consider SQL; I like it and use it a lot, but today a simple DELETE query on MySQL took three hours when I was expecting it to take twenty minutes at most. I had to kill the process because I could not wait more. Evidently MySQL had no clue how to optimize the operation in that case, but I could have done better if I wasn't expecting it to behave correctly on a simple (for my eyes!) DELETE FROM table WHERE col 'value'.) JN> By "*entire* rule" I meant the top-level one invoked by PARSE itself. I know, but that requires PARSE to be much more complex that it is now. And I'm not sure that it would be so much useful to be worth it, especially considering that I have yet to find a case in real work were PARSE does not work well. JN> In other words, when failure occurs, try a different alternative. You have to know all the alternatives! (As you show below.) But PARSE doesn't. It just knows the current position in the string or block and the current rule being matched. JN> All I'm trying to point out is that in a procedural model, the JN> programmer has to do more work to implement backtracking, You just need to place the longest-matching rules first. It's much less work that it seems, and to me it is almost natural now. JN> Thanks for the interesting discussion! All this said, I'd like to say that I'd welcome a pattern matching parser with backtracking and so on, just because I'm curious to see how much effort it is to write one. My bet is "too much", but of course the rest of the world seems to have a different POV. ;-) Wanna write one? Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: