A right-to-left type system for mutually-recursive value definitions

11/20/2018
by   Alban Reynaud, et al.
0

In call-by-value languages, some mutually-recursive value definitions can be safely evaluated to build recursive functions or cyclic data structures, but some definitions (let rec x = x + 1) contain vicious circles and their evaluation fails at runtime. We propose a new static analysis to check the absence of such runtime failures. We present a set of declarative inference rules, prove its soundness with respect to the reference source-level semantics of Nordlander, Carlsson, and Gill (2008), and show that it can be (right-to-left) directed into an algorithmic check in a surprisingly simple way. Our implementation of this new check replaced the existing check used by the OCaml programming language, a fragile syntactic/grammatical criterion which let several subtle bugs slip through as the language kept evolving. We document some issues that arise when advanced features of a real-world functional language (exceptions in first-class modules, GADTs, etc.) interact with safety checking for recursive definitions.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
11/06/2018

Unboxing Mutually Recursive Type Definitions in OCaml

In modern OCaml, single-argument datatype declarations (variants with a ...
research
01/03/2022

let (rec) insertion without Effects, Lights or Magic

Let insertion in program generation is producing code with definitions (...
research
07/25/2022

Evolving Recursive Definitions with Applications to Dynamic Programming

Inspired by computability logic<cit.>, we refine recursive function defi...
research
08/05/2022

Recurrence extraction and denotational semantics with recursive definitions

With one exception, our previous work on recurrence extraction and denot...
research
08/28/2019

Eliminating Left Recursion without the Epsilon

The standard algorithm to eliminate indirect left recursion takes a prev...
research
09/11/2018

Limitations in learning an interpreted language with recurrent models

In this submission I report work in progress on learning simplified inte...
research
06/20/2022

Semantic preservation for a type directed translation scheme of Featherweight Go

Featherweight Go (FG) is a minimal core calculus that includes essential...

Please sign up or login with your details

Forgot password? Click here to reset