what is easier to learn first?...

Tim Peters tim_one at email.msn.com
Wed Mar 22 09:06:18 CET 2000


[William Tanksley]
> ...
> (A note to experienced Pythoneers: Rebol uses an LL parser to handle
> text grovelling.

Do you know that's how it's implemented, or are you assuming "LL parser"
from the surface features?  My experience with PARSE in REBOL suggested it
was implemented via brute-force exhaustion (but that was last year; it may
have changed).

> It seems like such a thing should be easy to add to Python, and far
> preferable to regexps.  Any comments?

If they're not using a "real parser" under the covers, it doesn't meet the
#1 criterion for heavy regexp users:  raw speed.

Nicer pattern-matching facilities for Python stumble on two counts:  first,
it's clumsy to create pattern *objects* with forward- or self- references,
since there's no form of delayed evaluation (REBOL avoids this because "the
words" in "a block" aren't evaluated at the time the block is constructed);
second, it's hard to dream up a scheme that allows intermixing arbitrary
code with pattern matching (REBOL avoids this again by delaying block
evaluation, and making no syntactic distinction between data and code).

So all serious attempts to date in Python end up writing the grammar in
strings, and limiting code interaction to, e.g., callback invocation upon
reduction to a non-terminal.  John Aycock's SPARK system is especially nice
in taking an OO approach to mixing productions with callbacks.

> See the "parse" section of Rebol's documentation for the syntax Rebol
> uses;

Their FAQ is easier to grasp here:

   http://www.rebol.com/faq.html#11550948

> it's MUCH more Pythonic than regular expressions.)

Indeed, some days Python appears to be the least Pythonic of all languages
<wink>.

although-perl-is-the-perliest-ly y'rs  - tim






More information about the Python-list mailing list