2

I do not ask you to respect that the processor is a physical black box whereas interpreter implementation is not that clear. As CS, you must look at the functionality aspect -- both processor (physical machine?) and interpreter (virtual machine?) execute a program (a stream of commands).

Isn't to interpret the code just means to evaluate/to execute/to process it?

There is a long article on interpretation in Wikipedia. It uses a lot of words to explain what is interpretation and it even says that it is execution of instruction stream. But nobody stood up and stated that it is just what the processor does (like the child in the "Emperor new clothes")! Why should we think that these are two different things? Processors even invented JIT-compilation (called microcoding) earlier than virtual machines.

Also, bytecode interpretation should give additional clue. It looks like machine code absolutely (to be executed by virtual machines). So, are interpreters just virtual processors?

The self-checking questions are:

  1. What if vendor of your favorite processor discloses you a terrible secret that your instructions are not executed directly but converted into a true machine language beneath, before submitted to the real processor, is you language interpreted or machine?
  2. What if instruction stream for a real processor is executed by emulator (virtual machine) then is it executed by the processor or interpreted?
  3. Can the processor that executes an interpreted language (bytecode or script) is not a processor anymore but an interpreter?
Val
  • 857
  • 6
  • 16

1 Answers1

4

Usually, an interpreter is defined in computing terms: it executes instructions by issuing instructions to some lower level of processing. A processor is defined in physical terms: it executes instructions in electronic circuits. It's an interpreter if its behavior is ultimately defined by computer scientists, and a processor if its behavior is ultimately defined by physicists.

There's an exception: if the interpreter is defined in terms of emulating something that would normally be a physical processor, it's called a processor.

But it's only a matter of terminology. There's no profound distinction here. Just go with the flow.

  1. Mu. It's an interpreted machine language. Many processors work that way anyway (where do you draw the line between instruction decoding and interpretation? why would you want to draw a line?).
  2. Mu. It's a processor, and the processor is interpreted.
  3. Mu. If you posit that the language is interpreted then by definition it's interpreted by an interpreter. The interpreter may be a processor.
Gilles 'SO- stop being evil'
  • 44,159
  • 8
  • 120
  • 184