Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Quoting constructs (was: Re: Beautifier)

by jsprat (Curate)
on Jul 30, 2002 at 16:27 UTC ( #186258=note: print w/replies, xml ) Need Help??

in reply to Quoting constructs (was: Re: Beautifier)
in thread Perl code Beautifier?

As they say: "only perl can parse perl", but it doesn't make it easy, only possible :-)

Funny, I've always read that to mean "only perl (the binary) can parse perl (code)". As in, "it is very difficult to parse perl in exactly the way the interpreter does, so don't even try."

I guess there's more than one way to interpret it. Any thoughts?

  • Comment on Re: Quoting constructs (was: Re: Beautifier)

Replies are listed 'Best First'.
Re: Re: Quoting constructs (was: Re: Beautifier)
by thelenm (Vicar) on Jul 30, 2002 at 19:56 UTC
    I think that in the original quote, "perl" (lc) refers to the interpreter, and "Perl" (ucfirst) refers to the language. That's the main point I got from the quote. Here's a snippet from perlfaq1:

    What's the difference between "perl" and "Perl"?

    One bit. Oh, you weren't talking ASCII? :-) Larry now uses "Perl" to signify the language proper and "perl" the implementation of it, i.e. the current interpreter. Hence Tom's quip that "Nothing but perl can parse Perl." You may or may not choose to follow this usage. For example, parallelism means "awk and perl" and "Python and Perl" look OK, while "awk and Perl" and "Python and perl" do not. But never write "PERL", because perl isn't really an acronym, apocryphal folklore and post-facto expansions notwithstanding.

    -- Mike


Re^2: Quoting constructs (was: Re: Beautifier)
by Molt (Chaplain) on Feb 21, 2005 at 14:30 UTC

    Only perl can parse Perl as the language is exceptionally dynamic. It's more than possible, especially with source filters, to redefine the language's semantics on the fly.

    For an example consider that any program which claims to 'parse Perl' should be able to handle the results of the much loved Acme::Buffy module (which turns your entire code into the word 'Buffy' over and over, without affecting it's functionality) and you'll begin to see the issue.

    Now go one step further, ask the user whether they want to deBuffy source files and suddenly you have two different interpretations of the same code. Both interpretations are valid depending upon context, resulting in us not being able to parse both correctly as they're dependant upon state.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://186258]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2018-01-16 19:31 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (188 votes). Check out past polls.