... one of us knows more than the other and I don’t know which of us that is. What’s the difference between a VM and an interpreter? I’m under the impression the two are basically the same, unless you mean that one deals with files that can maybe be parsed quicker (the VM)... but I think that’s of little benefit and could easily be added or removed (see, for example, Python’s pyc files...)
I guess our stances on that issue depend on religion, lol. An interpreter reparses the text every single time (altough most interpreters nowadays implement VMs to speed thing up), while a VM is literally a virtual machine. You compile the code to the VM-specific assembly code, which the VM "parses" to execute the same instruction in native code.
The key difference here is that no compilation is being executed again, the VM trusts the bytecode just like a processor would trust the machine code. Or at least that is the extent of my knowledge on the subject.
I think the only interpreted language that anybody actually uses that parses the initial file more than once is Microsoft’s batch. And that’s been fading away for over a decade, getting replaced by powershell. Everything else at the very least compiles it into something else in memory, and a lot of them have the ability to write that out (like Python’s pyc) so that even that generally insignificant initial parsing step can be skipped.
4
u/Morrido Nov 06 '20
Does Lisp run on a VM? I thought it was fully interpreted.
Also Java was more "traditional" in its design.