Skip to content
HomeVideosBooks
AllTopicsTrends
BlogsPodcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    Cover of Compiling with Continuations

    Compiling with Continuations

    Andrew W. Appel · 1992

    This book shows how continuation-passing style is used as an intermediate representation to perform optimizations and program transformations. Continuations can be used to compile most programming languages. The method is illustrated in a compiler for the programming language Standard ML. Prior knowledge of ML, however, is not necessary, as the author carefully explains each concept as it arises. This is the first book to show how concepts from the theory of programming languages can be applied to the production of practical optimizing compilers for modern languages like ML. All the details of compiling are covered, including the interface to a runtime system and garbage collector.

    Computer ScienceProgramming
    Open LibraryAmazon
    Stats for nerds
    19recommend
    47mentions
    35people
    2009–2026years
    53% recommend45% neutral2% critical

    Mentions per year

    2009201120132015201720192021202320252026

    What Hacker News says

    1. pjmlpApr 2026
      It was a product of its time I guess, much better ones from similar vintage,

      The Tiger book (with C, Standard ML, and Java variants)

      https://www.cs.princeton.edu/~appel/modern/

      Compiler Design in C (freely available nowadays, beware this is between K&R C and C89)

      https://holub.com/compiler/

      lcc, A Retargetable Compiler for ANSI C

      https://drh.github.io/lcc/

      Or if one wants to go with more clever stuff,

      Compiling with Continuations

      Lisp in Small Pieces

      thread
    2. antonvsOct 2025
      I've never actually looked at that compiler, so can't comment on it, but have you read Appel's "Compiling with Continuations"? It motivates and explains the process very clearly. Add ANF into the mix and it's a very straightforward, well-defined system - much more so than SSA.
      thread
    3. mrkeenSep 2025
      > The book has no exercises. This positions it awkwardly in the broader perspective of compiler study. It’s as if it’s a book that isn’t meant to be studied or understood, or perhaps it just doesn’t care.

      I bought it because it demonstrated how to cps-transform code, which was my goal. I think it delivered.

      For a "broader perspective", see the follow-up papers:

        Compiling with Continuations, Continued (2007) (Cited by 154)” “The Essence of Compiling with Continuations (1993) (Cited by 806)” “Compiling with continuations, or without? whatever. (2019) (Cited by 34)”
      
      (...which TFA characterised as "parody")

      FWIW, after I implemented CPS this way, I eventually switched to ANF for typing reasons. I'm a bit of a beginner at type inference and could not assign a meaningful type to the extra term ("continuation") that CPS produces (and which ANF does not).

      thread
    4. fire_lakeJul 2024
      Appel has a book on compiling with CPS Compiling with Continuations. It’s implemented in SML so the types are front and center. Might be of use!
      thread
    5. undecidabotApr 2024
      Also worth reading: Compiling with Continuations, Continued (2007) [1]

      [1] https://www.microsoft.com/en-us/research/wp-content/uploads/...

      thread
    6. assbuttbuttassAug 2023
      Ultimately, diving deeper with only websites and articles can be quite challenging. I experienced this myself trying to learn more about the continuation passing style transformation in a compiler. No online websites or articles discussed the topic with any kind of depth.

      Ultimately I read the classic book "Compiling with Continuations", and it basically cleared up all my confusions.

      All of this is to say, don't discount books and courses. They will almost always be more in depth and correct than what you will find written up on a website.

      thread

    Related

    Cover of Modern compiler implementation in ML
    2009–2024

    Modern compiler implementation in ML

    Andrew W. Appel
    24 recommend · 68
    Cover of ML for the working programmer
    2009–2025

    ML for the working programmer

    Lawrence C. Paulson
    16 recommend · 38
    Cover of Compiler construction
    2008–2026

    Compiler construction

    Niklaus Wirth
    30 recommend · 81
    Cover of Engineering a compiler
    2007–2026

    Engineering a compiler

    Keith D. Cooper
    39 recommend · 91
    Cover of Modern compiler implementation in C
    2010–2024

    Modern compiler implementation in C

    Andrew W. Appel
    8 recommend · 13
    Cover of C interfaces and implementations
    2008–2026

    C interfaces and implementations

    David R. Hanson
    46 recommend · 114
    Cover of Recursive programming techniques
    2010–2019

    Recursive programming techniques

    William H. Burge
    3 recommend · 4
    Cover of The annotated C++ reference manual
    2013–2026

    The annotated C++ reference manual

    Margaret A. Ellis
    2 recommend · 13