News for hackers. Stuff that matters.
Re:Perl Cannot Be Parsed: A Formal Proof (2008) by alipang on Sunday May 26, 2013 @06:09AM (#5770683)
What does this mean for the potential of compiler optimization in Perl? You can't really throw around optimizations that work for 99% of the time.

I feel like the type of work that's done by browsers on JIT compiling Javascript would be really hard if you can't 100% reliably parse the language.

Re:Perl Cannot Be Parsed: A Formal Proof (2008) by dbaupp on Sunday May 26, 2013 @06:11AM (#5770691)
> You can't really throw around optimizations that work for 99% of the time.

You can, if you can detect (a superset of) the cases when it is invalid.

Re:Perl Cannot Be Parsed: A Formal Proof (2008) by 0x0 on Sunday May 26, 2013 @06:21AM (#5770711)
I believe JITting (code generation) happens at a later stage, after the source code had been parsed (or perhaps even "tokenized"/"lex'ed" is more appropriate?)

So even an "unreliable" syntax wouldn't matter much since the jitter kicks in after the parser had delivered its results.

Re:Perl Cannot Be Parsed: A Formal Proof (2008) by joosters on Sunday May 26, 2013 @06:28AM (#5770726)
I don't think this result means anything much for compiler optimization in Perl. Perl is definitely a difficult language to parse, a difficult language to interpret, and its flexibility makes for very tricky compilation (have there been any usable compilers for it?)

BUT - you can't really draw the link between a language that is turing-complete to parse, and one that is difficult to parse. An example of this would be to take the most simple, basic language you can think of, and add a backtick-like operation. As in, you can put `echo hello` into the source and the string will get replaced by the output of the enclosed command. The source language instantly becomes turing complete (you're having to execute code, after all), but your one-off parser hasn't become much more difficult (you just call exec() and wait for the output)

Re:Perl Cannot Be Parsed: A Formal Proof (2008) by chromatic on Sunday May 26, 2013 @06:15PM (#5772628)
I feel like the type of work that's done by browsers on JIT compiling Javascript would be really hard if you can't 100% reliably parse the language.

That's irrelevant in this case, because a hypothetical Perl 5 JIT wouldn't do much until the Perl 5 parser finished parsing its code. Remember, all this proof proves is that you cannot produce a single, unambiguous parse tree from every Perl 5 source file because of the syntactic construct that lets you change how the parser works for specific symbols.