{"id":24775447,"url":"https://github.com/ashton314/christmas-compiler","last_synced_at":"2026-07-11T07:01:46.394Z","repository":{"id":78330690,"uuid":"304817944","full_name":"ashton314/christmas-compiler","owner":"ashton314","description":"An experimental lambda calculus compiling to the LLVM","archived":false,"fork":false,"pushed_at":"2021-01-07T01:33:52.000Z","size":27,"stargazers_count":2,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-07T04:39:40.289Z","etag":null,"topics":["compiler","lambda-calculus","linear-types","lisp","llvm","racket","type-checking","type-inference"],"latest_commit_sha":null,"homepage":"","language":"Racket","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashton314.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-10-17T07:00:03.000Z","updated_at":"2023-03-02T01:57:37.000Z","dependencies_parsed_at":"2023-06-11T06:00:28.463Z","dependency_job_id":null,"html_url":"https://github.com/ashton314/christmas-compiler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ashton314/christmas-compiler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashton314%2Fchristmas-compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashton314%2Fchristmas-compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashton314%2Fchristmas-compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashton314%2Fchristmas-compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashton314","download_url":"https://codeload.github.com/ashton314/christmas-compiler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashton314%2Fchristmas-compiler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35353670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","lambda-calculus","linear-types","lisp","llvm","racket","type-checking","type-inference"],"created_at":"2025-01-29T06:54:29.000Z","updated_at":"2026-07-11T07:01:46.385Z","avatar_url":"https://github.com/ashton314.png","language":"Racket","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+TITLE: The Christmas Compiler\n\n#+begin_quote\nOh syntax tree, oh syntax tree,  \nHow lovely are thy derivations!\n#+end_quote\n\nChristmas break is coming up soon, and I all I want for Christmas is a compiler that:\n\n - Implements a small typed lambda calculus\n - Includes Hindley-Milner type inference\n - Replaces a garbage collector runtime with linear typing\n - Supports continuations\n - Is built with a nanopass framework so I can swap layers out to my liking\n\nI know Santa's busy this year, so I don't know if he'll get around to all those things, but we're going to try. This will be a victory if I learn something.\n\nIt will also be a good outlet for some Christmas-related puns.\n\nI am so sorry.\n\n#+begin_quote\nWrite yourself, some merry little IR,  \nIf the types will check  \nFrom now on, this variable is out of scope  \nAnd build yourself, a merry little compiler now\n#+end_quote\n\n* Synopsis\n\nRequires [[https://racket-lang.org/][The Racket Programming Language]], which is available for free for all major (and plenty of obscure!) platforms.\n\nAlso requires the LLVM. (At time of writing, this doesn't do any code generation, so you don't need this /right now/, but it will soon be a requirement.)\n\n** TODO Add link to documentation on how to get the LLVM toolkit\n\n** Tests\n\nRun Racket tests:\n\n#+begin_example\nmake test-racket\n#+end_example\n\n* Description\n\nThe compiler works in a series of small passes over the code/abstract syntax tree (AST), each of which performs small modifications to the AST or provides some insight into what the AST is doing. The first pass parses the raw source langauge into an AST. The defintions of the AST nodes can be found in [[file:passes/ast.rkt][passes/ast.rkt]]. Once all the passes have finished, the final pass converts the AST into LLVM IR. The LLVM then turns this into machine code.\n\nInspiration for the \"nanopass\" architecture came from /Educational Pearl: A Nanopass Framework for Compiler Education/ [fn:1], with some inspiration from a more minimal guide /An Incremental Approach to Compiler Construction/ [fn:2].\n\n** Rationale\n\nI decided to use the LLVM because it handles the hard work of machine-specific assembly/machine code generation, and I wanted a compiler that would work both on my desktop (which uses an Intel processor) and my Raspberry Pi (which is an ARM architecture).\n\n* Language\n\n** Description\n\nThe compiler implements a simple lambda calculus. At time of writing, this language is untyped, but static typing with type inference will come at a later step.\n\n*** TODO Fill out this section\n\n** TODO Examples\n\n* Author\n\nAshton Wiersdorf \u003cashton.wiersdorf@pobox.com\u003e\n\n* Footnotes\n\n[fn:1] D. Sarkar, O. Waddell, and R. K. Dybvig, “Educational Pearl: A Nanopass Framework for Compiler Education,” J. Funct. Prog., vol. 15, no. 05, p. 653, Jun. 2005, doi: 10.1017/S0956796805005605. http://www.pup.si/files/pdf_file/nano-jfp.pdf\n\n[fn:2] A. Ghuloum, “An Incremental Approach to Compiler Construction,” p. 11, 2006. http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.88.170\u0026rep=rep1\u0026type=pdf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashton314%2Fchristmas-compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashton314%2Fchristmas-compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashton314%2Fchristmas-compiler/lists"}