Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Why is functional programming such a great fit for Compilers?

7/22/2025

Compilers essentially consiste of two operations:

  • Analyzing code
  • Transforming code

It is not much of an exaggeration to say that every single operation in a compiler is doing one or both of those operations.

Both of these operations are themselves comprised of:

  • Recursive pattern matching and rewrites
  • Structure composition, decomposition and recomposition