6 ms·
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
by alipang 13y ago
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.
- dbaupp 13y ago> 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.
- 0x0 13y agoI 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.
- joosters 13y agoI 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)
- chromatic 13y agoI 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.