3
$\begingroup$

The Wikipedia page about interpreters mentions the following three strategies

  1. Parse the source code and perform its behavior directly
  2. Translate source code into some efficient intermediate representation or object code and immediately execute that
  3. Explicitly execute stored precompiled bytecode made by a compiler and matched with the interpreter Virtual Machine.

Isn't byte-code intermediate representation? What is the difference between 2 and 3? The use of VM?

$\endgroup$

1 Answer 1

3
$\begingroup$

This is from just the summary of the article, and I'm not sure that it is a terribly helpful one.

What I think the author was trying to say is that the difference between 2 and 3 is who translates the source code into an intermediate representation. If that translation is done ahead of time (as you see in JVM languages or dotnet), that's more or less number 3. If it's done by the interpreter (i.e. the input to the interpreter is source code), then that's more like number 2.

Note that there is also a fuzzy boundary between 1 and 2. Tree-based IRs do exist, so at what point does a very sophisticated abstract parse tree become an efficient intermediate representation?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.