What exactly is the difference between bytecode and a parse tree, specifically the one used by Perl? Do they actually refer to the same concept, or is there a distinction?
I’m familiar with the concept of bytecode from Python and Java, but when reading about Perl, I’ve learned that it supposedly executes a parse tree (instead of bytecode) in its interpreter.
If there actually is a distinction, what are the reasons for Perl not using bytecode (or Python not using parse trees)? Is it mainly historical, or are there differences between the languages that necessitate a different compilation/execution model? Could Perl (with reasonable effort and execution performance) be implemented by using a bytecode interpreter?
What Perl uses is not a parse tree, at least not how Wikipedia defines it. It’s an opcode tree.
Except, despite being called a tree, it’s not really a tree. Notice the arrows? It’s because it’s actually a list-like graph of opcodes (like any other executable).
The difference between Perl’s opcodes and Java’s bytecodes is that Java’s bytecodes are designed to be serialisable (stored in a file).