terminology - Is my understanding of interpreter and compiler correct? -


I was thinking that my understanding about interpreters and compilers is correct:

  1. I think the compiler translates only from source code into binary code, whereas a translator works not only in translation but also executing whatever is generated after compilation.
  2. Is an interpreter always a part of the compilation?
  3. Does the compiler not always execute the binary code?

    Sorry to ask the wrong questions. Thanks and regards!

    1. You are right about the compiler, but wrong about interpreter . The interpreter does not need to translate anything, just reads the piece of code and "interprets it" - executes what he has read. For example, it reads 1 + 2 and then the function sum (1, 2) .

    2. The interpreter can use the compilation for optimization purposes (like this hot spot uses JIT compilation in JVM).

    3. Good, compile is to "compile" - translate source code into binary code. So the answer to your question - yes This is not his job.

Comments