Interpreters: How much simplification?

Posted by Ray on Stack Overflow See other posts from Stack Overflow or by Ray
Published on 2010-05-11T15:36:50Z Indexed on 2010/05/11 16:14 UTC
Read the original article Hit count: 272

Filed under:

In my interpreter, code like the following

x=(y+4)*z
echo x

parses and "optimizes" down to four single operations performed by the interpreter, pretty much assembly-like:

add 4 to y
multiply <last operation result> with z
set x to <last operation result>
echo x
  • In modern interpreters (for example: CPython, Ruby, PHP), how simplified are the "opcodes" for which are in end-effect run by the interpreter?

  • Could I achieve better performance when trying to keep the structures and commands for the interpreter more complex and high-level? That would be surely a lot harder, or?

© Stack Overflow or respective owner

Related posts about interpreter