arXiv:2610.31201cs.PLOct 2026

Manuscript Offprint

arXiv:2610.31201

The Reversible Intermediate Language L4, its Type System, and its Bidirectional Small-Step Semantics

Torben Ægidius Mogensen

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Torben Egidius Mogensen 1^{1}[0000-0003-4862-9193]

DIKU, University of Copenhagen

Universitetsparken 5, DK-2100 Copenhagen O, Denmark

torbenm@di.ku.dk

Abstract. L4 is a generic, reversible, linearly-typed, low-level language intended as an intermediate language for compiling reversible programming languages to reversible machines. L4 is intended to replace and generalise RSSA, a reversible SSA form. Inspiration is drawn from other low-level reversible languages such as HSSA.

In this paper, we define L4 first informally, and then give a formal type system and a bidirectional small-step semantics for L4: The rules have direction indicators to determine forwards or backwards execution, and the direction can be changed during execution.

1 Introduction

RSSA [8] is a reversible variant of the static single-assignment form SSA [1,11]. RSSA has a specific set of instructions corresponding to the instructions of an earlier reversible intermediate language RIL [7], which limits its generality. Furthermore, RSSA is untyped, so it lacks the safety and specificity of statically typed languages. HSSA (Hybrid SSA) [3] generalises RSSA both by not keeping the instruction set fixed and by adding an irreversible instruction that discards its input. Additionally, HSSA uses a notation that makes it explicit which variables are created, eliminated, or just used by an instruction. For L4, we use a notation inspired by both RSSA and HSSA, but add a type system, and generalise conditional entries and exits. We thank Lukas Gail for discussions about the design of HSSA and L4. The name “L4” stands for “Linear, Low-Level Language”.

We first give an informal description of L4, then a formal type system, and finally a bidirectional small-step semantics.