<?xml version="1.0" encoding="windows-1252"?>
<node id="663480" title="Re^2: Perl Cannot Be Parsed: A Formal Proof (meh)" created="2008-01-21 18:51:24" updated="2008-01-21 13:51:24">
<type id="11">
note</type>
<author id="641652">
Jeffrey Kegler</author>
<data>
<field name="doctext">
&lt;p&gt;You spotted an unclarity in my presentation.  I was vague about what "time" the code strings are to be run.  Perhaps this is better:

&lt;code&gt;
sub halts {
    my $machine = shift;
    my $input = shift;
    is_whatever_nullary(
       qq{
          BEGIN {
               run_turing_equivalent("\Q$machine\E", "\Q$input\E");
               sub whatever() {};
          }
       }
    )
}
&lt;/code&gt;

&lt;p&gt;Using &lt;i&gt;rand()&lt;/i&gt; is indeed more obvious and it was how I tested my code snippets (I lent my Halting Oracle to a friend and she never returned it ... but don't get me started.)  I did not use it in the presentation because while it makes the proof more obvious, it's a proof of a weaker theorem.

&lt;p&gt;If you interpret &lt;i&gt;rand()&lt;/i&gt; as truly random (and not as pseudo-random), then we're dealing with non-deterministic programs.  Someone might then say, "as long as there is no non-determinism while compiling, Perl 5 is statically parseable."  But it's not and a proof using the Turing machine simulator shows it is not.  That Perl 5 is unparseable even when the code is completely deterministic is a much stronger result, and the distinction makes a difference in practice.

&lt;p&gt;The Turing simulation in this case is brought in for very practical reasons.  I can't claim the credit for that.  Adam Kennedy's hint took me in this direction.  I suspect he also knew the business about &lt;i&gt;rand()&lt;/i&gt;.  But with his many hours of real life experience trying to statically parse Perl, he focused on the stronger proof -- the one that would give him the most information about what he was up against in creating [mod://PPI].
</field>
<field name="root_node">
663393</field>
<field name="parent_node">
663416</field>
</data>
</node>
