Re: What do you need to have to be considered a Master at Perl?




Jürgen Exner > ...
Sherm Pendley > ..
...
Someone who understands the Chomsky hierarchy,
and why not every context-free language can be
described with a regular grammar.

:-))

YMMD

~~~~~~~~~~~~~~~~~~~~~~~~~
I looked it up:

Acronym Definition

YMMD You Made My Day
or
YMMD Your Mileage May Differ

~~~~~~

I took a course in recursive function theory many many years ago
(grad-level, math dept) --- which I have completely forgotten,
except that I am quite certain that perl was never mentioned in it.

I don't think perl actually existed back then. So I wasn't disappointed
about that. But I did happen to have read Chomsky's "Syntactic Structures",
in which he talked about 'transformational grammar",and
"deep vs surface structure" (--which was his contribution,
-the hierarchy stuff coming from a different, math-logic tradition.)

At the time I thought that was really fascinating stuff.
But none of it was in course either. And I was
disappointed about that.

~~

As I said before, in this thread, I have recently learned
how to match balanced parentheses.

But that was a botched joke, because what I meant to say was that
"I've learnt how to match balanced parentheses with regular expressions."

However, whether "recursive regular expressions" is an oxymoron,
or whether perl forces us to expand the definition of "regular expression",
isn't the sort of terminological question that could ever bother me.

I've seen maybe dozens, maybe hundreds, of utterly astonishingly
different embodiments of the hierarchy. And the great beauty of the
subject is seeing what they have in common, in terms of what
can and can't be accomplished at the different abstract levels.
The beauty of the subject is very similar to Galois theory.
One practical spin-off of which is that no rational person
will ever try to "square the circle with ruler and compass alone."

Likewise, I am definitely not an expert. But I do feel, for example,
that I have an effectively computed elementary intuition that balanced
parentheses simply can not be parsed by any kind of machine
unless it has some kind of equivalent of an unlimited memory
or push down stack. No matter how deeply it's hidden, it has
to be there somewhere.

The perlre section on (??{code}) warns that

Recursing deeper than 50 times without consuming
any input string will result in a fatal error. The maximum
depth is compiled into perl, so changing it requires a
custom build.

And I don't really understand that.
But my intuition tells me that it means that the perl regex engine
is still a true "regular expression" engine.
That is, it does not have an infinite push down stack.
So the tricks with (??{code}) or (?PARNO) can only give
the illusion of being able to parse balanced constructs.
I wouldn't needs to know how they work to know that.

If the warning had said "recursing deeper than 50 times...will result in a fatal error"
then I would have felt I understood it. What I do not understand
is how "consuming ... input string" could change the situation.

I am sure that I ran across that section in perlre about (??{ code })
a long time ago, but immediately forgot about it because of the dire

WARNING: This extended regular expression feature is considered experimental
and may be changed without notice..."

etc.

And now 5.10 has the (?PARNO) feature that is said to be
a "more efficient way to accomplish the same task".
But it too has warnings.

Now, I don't care if perl regular expressions are or aren't kosher.
It's those warnings that bother me.

And I was hoping that a perl-expert would "talk me down"
about being too afraid to use them.

~greg












.



Relevant Pages

  • Re: Isolating a word with a certain pattern
    ... I'm not entirely sure of what you mean by "isolating" a word, but Perl ... programmers often use regular expressions to locate and manipulate ... You can look at 'perldoc perlre' for more info on regular ...
    (perl.beginners)
  • Re: Regular expression help
    ... expression in english is a daunting task for me. ... Redefine your approach to regular expressions. ... Perl documentation, study the examples given (not only by ...
    (comp.lang.perl.misc)
  • Re: How to change the comparsion criteria of diff?
    ... I'm meeting the problem with diff methods in Perl. ... one containing regular-expression string ... normal regular expression does. ...
    (comp.lang.perl.misc)
  • Re: regular expression and not form
    ... How can I express "match any string except 'ABC'" in regular ... If you can use tools supporting Perl-compatible regex, like Perl, ...
    (comp.unix.shell)
  • Re: Most powerful regular express string replace tool?
    ... The best way is not to use regular expressions but a real HTML ... There are Perl modules that can do this. ...
    (comp.unix.shell)