+ 4

[Theoretical] Compiling high-level languages to assembly - what features are unconvertable?

I've found come conflicting claims regarding compiling high-level interpreted and VM-dependent languages (Python, Java, JS, etc.) to assembly. VM-dependent languages get compiled to their variant of bytecode which gets translated to assembly on runtime. Interpreters likewise end up eventually converting source code to assembly commands. Hence, it seems that it should theoretically be possible to complete this translation ahead of time in all cases. However, I've heard claims that Lambda calculus and automatic memory management make it theoretically not possible to compile to assembly. I couldn't find any legitimate evidence, though. So my question is this: What features of existing languages would make code not compilable to assembly ahead-of-time? Both opinions and factual evidence are welcome.

28th Aug 2020, 4:29 PM
BlazingMagpie
BlazingMagpie - avatar
2 ответов
+ 4
VM-dependent and interpreter don't convert their code/bytecode into Assembly, rather they convert it into machine code. machine code is not Assembly. compiling the code to native machine code is possible depending on the language, there are compilers that can do it. but that will defeat the purpose of those VMs which is mainly, portability, security and performance. theoretically it should be possible to convert the code to machine code directly, looking at the internals of VMs/interpreters, but it's not that simple. (my opinion)
28th Aug 2020, 5:24 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 4
Syntax errors?
29th Aug 2020, 5:09 AM
Sonic
Sonic - avatar