Papers
Topics
Authors
Recent
Search
2000 character limit reached

let (rec) insertion without Effects, Lights or Magic

Published 3 Jan 2022 in cs.PL and cs.SC | (2201.00495v1)

Abstract: Let insertion in program generation is producing code with definitions (let-statements). Although definitions precede uses in generated code, during code generation uses' come first: we might not even know a definition is needed until we encounter a reoccurring expression. Definitions are thus generatedin hindsight', which explains why this process is difficult to understand and implement -- even more so for parameterized, recursive and mutually recursive definitions. We have earlier presented an interface for let(rec) insertion -- i.e. for generating (mutually recursive) definitions. We demonstrated its expressiveness and applications, but not its implementation, which relied on effects and compiler magic. We now show how one can understand let insertion, and hence implement it in plain OCaml. We give the first denotational semantics of let(rec)-insertion, which does not rely on any effects at all. The formalization has guided the implementation of let(rec) insertion in the current version of MetaOCaml.

Citations (2)

Summary

Paper to Video (Beta)

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Continue Learning

We haven't generated follow-up questions for this paper yet.

Authors (2)

Collections

Sign up for free to add this paper to one or more collections.