Towards Exact Semantic Equivalence of Erlang BEAM Constructs: Lessons from Advanced Emulation and Decompilation
Year: 2026
Type: conference-paper
Abstract: Erlang offers three practically relevant ways to run code: evaluating abstract syntax trees with erl_eval, interpreting compiled BEAM instructions with an emulator written in Erlang, and executing compiled BEAM on the BEAM VM itself. For most programs these execution modes agree, but exact equivalence breaks down at a few places that matter directly to decompilers, symbolic evaluators, refactoring tools, and alternative runtime implementations. We study four such places in detail: binary pattern matching, fun values, selective receive, and exception metadata such as stack traces and line numbers. Our aim is not merely to catalogue awkward corner cases, but to separate what can already be reproduced exactly in plain Erlang from what still depends on BEAM-specific support or modest language/runtime extensions. Along the way we recover direct Erlang equivalents for non-trivial binary encodings, explain the evaluator's closure-adaptation problem at the arity limit, analyze why selective receive remains the most BEAM-specific construct, and identify the state that must be preserved if an Erlang-level emulator is to present compiled-BEAM behavior faithfully. The result is a more comprehensive boundary map of emulation completeness for Erlang.
Authors: Gregory Morse, Melinda Tóth
Institution: Eötvös Loránd University
Language: English
Subfield: Software
Field: Computer Science
Domain: Physical Sciences
Open Access status: hybrid
OpenAlex ID: W7203905957
