frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Compiling a Lisp: Lambda Lifting

https://bernsteinbear.com/blog/compiling-a-lisp-12/
57•azhenley•3h ago

Comments

Jtsummers•2h ago
If you like Ghuloum's paper, there are three fairly recent compiler books that are inspired by it:

https://nostarch.com/writing-c-compiler - Writing a C Compiler by Nora Sandler, language agnostic for the implementation.

https://mitpress.mit.edu/9780262047760/essentials-of-compila... - Essentials of Compilation (using Racket) by Jeremy Siek

https://mitpress.mit.edu/9780262048248/essentials-of-compila... - Essentials of Compilation (using Python) by Jeremy Siek

Those last two both have open access versions.

dang•1h ago
The paper itself has been discussed a few times:

An Incremental Approach to Compiler Construction (2006) [pdf] - https://news.ycombinator.com/item?id=29123715 - Nov 2021 (10 comments)

An Incremental Approach to Compiler Construction (2006) [pdf] - https://news.ycombinator.com/item?id=20577660 - July 2019 (5 comments)

An Incremental Approach to Compiler Construction (2006) [pdf] - https://news.ycombinator.com/item?id=13207441 - Dec 2016 (19 comments)

An Incremental Approach to Compiler Construction (2006) [pdf] - https://news.ycombinator.com/item?id=10785164 - Dec 2015 (13 comments)

Writing a Compiler in 24 Small Steps [pdf] - https://news.ycombinator.com/item?id=1652623 - Sept 2010 (16 comments)

An Incremental Approach to Compiler Construction - https://news.ycombinator.com/item?id=1408241 - June 2010 (18 comments)

(and also in comments: https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...)

WantonQuantum•2h ago
The "lambda lifting" seems to be referring to section 3.11 "Complex Constants" in the linked Ghuloum PDF:

Scheme’s constants are not limited to the immediate objects. Using the quote form, lists, vectors, and strings can be turned into constants as well. The formal semantics of Scheme require that quoted constants always evaluate to the same object. The following example must always evaluate to true:

    (let ((f (lambda () (quote (1 . "H")))))
      (eq? (f) (f)))
So, in general, we cannot transform a quoted constant into an unquoted series of constructions as the following incorrect transformation demonstrates:

    (let ((f (lambda () (cons 1 (string #\H)))))
      (eq? (f) (f)))
One way of implementing complex constants is by lifting their construction to the top of the program. The example program can be transformed to an equivalent program containing no complex constants as follows:

    (let ((tmp0 (cons 1 (string #\H))))
      (let ((f (lambda () tmp0)))
        (eq? (f) (f))))
Performing this transformation before closure conversion makes the introduced temporaries occur as free variables in the enclosing lambdas. This increases the size of many closures, increasing heap consumption and slowing down the compiled programs. Another approach for implementing complex constants is by introducing global memory locations to hold the values of these constants. Every complex constant is assigned a label, denoting its location. All the complex constants are initialized at the start of the program. Our running example would be transformed to:

    (labels ((f0 (code () () (constant-ref t1)))
             (t1 (datum)))
      (constant-init t1 (cons 1 (string #\H)))
      (let ((f (closure f0)))
        (eq? (f) (f))))
The code generator should now be modified to handle the data labels as well as the two internal forms constant-ref and constant-init.
JonChesterfield•2h ago
The idea is to move variables from the body of the function to the argument list and rewrite the call sites to match.

That decreases the size of the closure (and increases the size of the code, and of however you're passing arguments).

Do it repeatedly though and you end up with no free variables, i.e. no closure to allocate. Hence the name, the lambda (closure) has been lifted (through the call tree) to the top level, where it is now a function (and not a lambda, if following the usual conflating of anonymous function with allocated closure).

Doesn't work in the general case because you can't find all the call sites.

Volunteers fight to keep 'AI slop' off Wikipedia

https://www.washingtonpost.com/technology/2025/08/08/wikipedia-ai-generated-mistakes-editors/
1•bookofjoe•59s ago•0 comments

Alleged AI-induced psychotic breaks

https://twitter.com/techno0ptimist/status/1945674714162380972
1•lando2319•7m ago•0 comments

Going Dark

http://techno-fandom.org/~hobbit/cars/ev/offnet.html
2•pilingual•11m ago•0 comments

I Made a Floppy Disk from Scratch [video]

https://www.youtube.com/watch?v=TBiFGhnXsh8
1•geerlingguy•12m ago•0 comments

Nvidia and AMD to pay 15% of their China sales revenue to the US govt

https://www.bbc.com/news/articles/cvgvvnx8y19o
1•darth_avocado•12m ago•0 comments

Pastebin but Useless

https://www.crapboard.com
1•streetmeat•12m ago•1 comments

Software 3.0

https://www.keithrozario.com/2025/08/software-3-0.html
2•keithrozario•16m ago•0 comments

Tesla Cybertruck deactivated on highway due to use in music video

https://old.reddit.com/r/CyberStuck/comments/1mmbq9w/lets_go_ahead_and_deactivate_here_looks_like_a/
3•echelon•19m ago•1 comments

Nyxt: The Emacs-like web browser

https://lwn.net/Articles/1001773/
2•signa11•20m ago•0 comments

Setting up a CI server for Forgejo

https://robey.lag.net/2025/08/10/forgejo-ci.html
2•todsacerdoti•24m ago•0 comments

Why Jamaica Is Obsessed with Clark Boots [video]

https://www.youtube.com/watch?v=JzAgs47Idzw
1•x1ph0z•25m ago•0 comments

GreedyBear: Attack Tools, One Coordinated Campaign

https://blog.koi.security/greedy-bear-massive-crypto-wallet-attack-spans-across-multiple-vectors-3e8628831a05
1•jnord•28m ago•0 comments

The amazing i820 saga

https://redhill.net.au/c/c-g.php#i820
1•Lammy•31m ago•0 comments

Origin and History of Bury

https://www.etymonline.com/word/bury
1•thunderbong•32m ago•0 comments

BU-808: How to Prolong Lithium-Based Batteries

https://batteryuniversity.com/article/bu-808-how-to-prolong-lithium-based-batteries#google_vignette
1•vismit2000•33m ago•0 comments

Israel again killed another prominent Palestinian journalist

https://www.aljazeera.com/news/2025/8/10/al-jazeera-journalist-anas-al-sharif-killed-in-israeli-attack-in-gaza-city
4•proshno•33m ago•0 comments

Am I Healthy? How to design a comprehensive health score

https://www.empirical.health/blog/designing-health-radar/
1•brandonb•34m ago•0 comments

Optimizing My Sleep Around Claude Usage Limits

https://mattwie.se/no-sleep-till-agi
2•mattwiese•34m ago•0 comments

Show HN: No-huddle.net for better Slack huddle etiquette

https://no-huddle.net
1•shubham_rai•35m ago•0 comments

Nvidia, AMD to pay 15% of China chip sale revenues to US, official says

https://www.reuters.com/world/china/nvidia-amd-pay-15-china-chip-sale-revenues-us-official-says-2025-08-10/
1•voxadam•37m ago•1 comments

Nvidia GPU Blackmarket [video]

https://www.youtube.com/watch?v=ltgyS8oJC8g
1•testrun•47m ago•0 comments

GitHub CEO: Future devs will not code, they will manage AI

https://www.theregister.com/2025/08/07/github_ceo_ai_coding/
1•docmechanic•47m ago•2 comments

Study Finds Smartwatches Aren't That Good at Measuring Stress

https://gizmodo.com/new-study-finds-smartwatches-arent-that-good-at-measuring-stress-2000640868
1•brandonb•49m ago•0 comments

Ask HN: What are some comfy/stress-free jobs a SWE can do? (LCOL country)

3•ejlanor•51m ago•1 comments

Development of Baba Is You [video]

https://www.youtube.com/watch?v=cmYlCRt460U
1•henning•58m ago•0 comments

Angle brackets in a Nix flake world

https://fzakaria.com/2025/08/10/angle-brackets-in-a-nix-flake-world
1•setheron•1h ago•0 comments

Ray Brooks, British actor and voice of Mr Benn, dies aged 86

https://www.theguardian.com/tv-and-radio/2025/aug/11/ray-brooks-british-actor-and-voice-of-mr-benn-dies-aged-86
2•toomuchtodo•1h ago•1 comments

Show HN: Job Shield – a job trust verification platform

3•NazSingapore•1h ago•0 comments

TCS lays off over 10k for reasons including AI, hikes wages for survivors

https://www.theregister.com/2025/08/11/asia_tech_news_in_brief/
1•gpi•1h ago•0 comments

Biomimetic layered, ecological, multi-functional film for sustainable packaging

https://www.nature.com/articles/s41467-025-61693-2
2•PaulHoule•1h ago•0 comments