Hacker News new | ask | show | jobs
by tyingq 2117 days ago
"question: is there a language that can’t be compiled?"

There is some question whether Perl could be, because parsing it without running it has some ambiguity. https://www.perlmonks.org/?node_id=663393

2 comments

That's not really a barrier. It's "can't be parsed without ambiguity", not "can't be parsed". You compile cases like that by compiling a check for the relevant condition, then compile the possible versions in the if/else branches. Unless you can prove which case it will be from other code - then you can simplify anyway.
By wielding the Futamura projections [0][1][2], any interpreter may be turned into a compiler. Perl is handled as one case. Crucially, the resulting compiler need not be fast; if the interpreter is slow, then the compiler will be slow too (this is a special case of the central meme from [3], "if the N'th Futamura projection has quality Q, then the N+1'th Futamura projection will also have quality Q.")

[0] https://en.wikipedia.org/wiki/Partial_evaluation#Futamura_pr...

[1] http://blog.sigfpe.com/2009/05/three-projections-of-doctor-f...

[2] https://www.gwern.net/docs/cs/2009-gluck.pdf

[3] https://www.itu.dk/people/sestoft/pebook/