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

[REBOL] Re: Parse versus Regular Expressions

From: lmecir:mbox:vol:cz at: 9-Apr-2003 19:00

Hi all, Joel wrote:
> 1) It makes the PARSE dialect a strange hybrid between declarative > and procedural descriptions (as mentioned in my earlier post).
Inspired by this POV I decided to read some articles and found out, that PARSE probably isn't a hybrid at all, it is a purely procedural thing based on the lambda calculus.
> 2) It totally breaks normal usage that "or" is symmetrical, even > though we read the | as "or".
...
> Notice, however, the differences in behavior of the following > attempts at parse rules. > > parse "ba" ["b" | "ba"] ; == false > parse "ba" ["b" ["" | "a"]] ; == false > parse "ba" ["b" [end | "a"]] ; == true > parse "ba" ["b" end | "ba"] ; == true > parse "ba" ["b" end | "ba" end] ; == true > parse "ba" [["b" | "ba"] end] ; == false > > AFAIK the only answers to "Why are these different?" would be > a) a complicated description of the implementation, or > b) a rationale based on emphasizing some other detail than > the obvious "what would most people expect" issue.
My reading revealed, that the "and" and "or" names are inappropriate and that in the lambda calculus it is usual to call the operators "andalso" and "orelse". Regards -Ladislav