Interpreters

Reverse Polish Notation is a convenient form for evaluating expressions. The infix notation can be converted into RPN using Dijkstra's Shunting yard algorithm.

RPN is a post-order traversal of an AST.

Expression: (1 + 2) * (3 + 4)

AST: Binary('*', Binary('+', 1, 2), Binary('+', 3, 4))

RPN: 1 2 + 3 4 + *

  • Inline cache — storing method lookup information into the call site (directly to bytecode). Call site can be uninitialized, monomorphic, megamorphic.
  • Switching from interpreted code in the middle of a running method is called on-stack-replacement (OSR).

Related

Links