Skip to main content
Kent Academic Repository

AST, Bytecode, and the Space In Between: An Exploration of Interpreter Design Tradeoffs

Larose, Octave, Vollmer, Michael, Marr, Stefan (2025) AST, Bytecode, and the Space In Between: An Exploration of Interpreter Design Tradeoffs. In: ICOOOLPS 2025 – Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems, 2 Jul 2025, Bergen, Norwey. (In press) (KAR id:110374)

Abstract

Programming language interpreters usually interpret either an abstract syntax tree (AST) or bytecode (BC). An AST can be a tree of objects, which may be slow to interpret, while bytecode is a compact encoding that can give better run-time performance.

However, defining the key characteristics of both interpreter designs is not straightforward. If the AST is encoded using an array instead of a pointer-based structure, is it still an AST interpreter? If bytecodes are represented as objects instead of compact bytes, is it still a bytecode interpreter?

In this paper, we explore the different design dimensions for the implementation of interpreters and discuss their tradeoffs and how they relate to AST and bytecode-based designs. They create a spectrum from benefiting from the host language to minimizing distance with the target machine. From the discussion, we derive guidelines for interpreter designs that enable implementers to navigate the tradeoff space between performance, engineering, tooling support, and language needs.

Finally, we discuss common optimizations that are independent of the program representation to demonstrate the performance of an optimized AST interpreter and bytecode interpreter implemented in Rust. While the bytecode interpreter is slightly faster, the difference is small, and we find the discussed optimizations to be more relevant for performance than the program representation, which we argue gives implementers more freedom in choosing a point in the design than generally assumed.

Item Type: Conference or workshop item (Paper)
Uncontrolled keywords: interpreters, bytecode, abstract-syntax-tree, language implementation, comparison
Institutional Unit: Schools > School of Computing
Former Institutional Unit:
There are no former institutional units.
Funders: Engineering and Physical Sciences Research Council (https://ror.org/0439y7842)
Oracle (United Kingdom) (https://ror.org/01pe8xs92)
Depositing User: Stefan Marr
Date Deposited: 25 Jun 2025 16:27 UTC
Last Modified: 26 Jun 2025 15:15 UTC
Resource URI: https://kar.kent.ac.uk/id/eprint/110374 (The current URI for this page, for reference purposes)

University of Kent Author Information

  • Depositors only (login required):

Total unique views of this page since July 2020. For more details click on the image.