principleMinor
Intermediate Representation vs Byte Code
Viewed 0 times
codebyterepresentationintermediate
Problem
The Wikipedia page about interpreters mentions the following three strategies
Isn't byte-code intermediate representation? What is the difference between 2 and 3? The use of VM?
- Parse the source code and perform its behavior directly
- Translate source code into some efficient intermediate representation or object code and immediately execute that
- 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?
Solution
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?
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?
Context
StackExchange Computer Science Q#163398, answer score: 3
Revisions (0)
No revisions yet.