Skip to content

Conversation

@elegios
Copy link
Contributor

@elegios elegios commented Feb 4, 2025

This PR has two changes to lambda lifting.

First, we now return a more precise value describing the changes made during the transformation (e.g., we don't depend on iteration order of Names in a Map, we store both the names of captured variables and their corresponding inserted parameters).

Second, there's a new language fragment implementing a slight variation of standard lambda lifting, where we don't insert extra parameters for globally bound variables.

For example, previously

let x = 1 in
let f = lam. x in
... f () ...

would get lambda lifted to something like

let x = 1 in
let f = lam x2. lam. x2 in
... f x () ...

which is useful if you fully want to remove all closures, but redundant if you're fine with letting functions reference top-level values.

@elegios elegios force-pushed the lambda-lift-changes branch 3 times, most recently from 970348f to 088a26c Compare March 4, 2025 11:05
@elegios elegios force-pushed the lambda-lift-changes branch from 088a26c to 4898ec9 Compare March 6, 2025 15:54
@elegios elegios force-pushed the lambda-lift-changes branch from 4898ec9 to 3327c3c Compare March 12, 2025 12:27
@david-broman david-broman merged commit 79bb08d into miking-lang:develop Mar 15, 2025
1 of 2 checks passed
wmuth pushed a commit to wmuth/miking that referenced this pull request Mar 15, 2025
* Make lambda lifting give more detailed information in its solutions

* Add alternate lambda lift that allows capture of global variables
@elegios elegios deleted the lambda-lift-changes branch April 16, 2025 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants