Skip to content

Files

Latest commit

635669d · Feb 5, 2025

History

History

scheme2c

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jan 28, 2025
Feb 5, 2025
Jan 29, 2025
Jan 29, 2025
Jan 30, 2025
Jan 28, 2025

scheme to C

This project compiles a tiny subset of scheme to C, the point is

  1. lowering let to begin (set! ...)
  2. remove complex operands from if
  3. simplify expression in set!, C won't accept (if ...) and (begin ...) (block is not a value in C, unlike Scala or Rust). This step also about control flow, set! be seen as a statement, not an expression
  4. explicate control flow by forwarding return statement

references

  1. A Low-Level Look at A-Normal Form: https://www.williamjbowman.com/resources/wjb2024-anf-is-dead.pdf