{"id":19778018,"url":"https://github.com/andrew-johnson-4/bootstrapbook","last_synced_at":"2025-02-28T05:54:08.430Z","repository":{"id":220210397,"uuid":"751047616","full_name":"andrew-johnson-4/BootstrapBook","owner":"andrew-johnson-4","description":"Learn how to Write a Compiler in 2000 Lines of Code","archived":false,"fork":false,"pushed_at":"2024-02-25T21:45:50.000Z","size":43,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-11T01:57:19.074Z","etag":null,"topics":["book","compilers","tutorial"],"latest_commit_sha":null,"homepage":"https://github.com/andrew-johnson-4/BootstrapBook/wiki","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrew-johnson-4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-01-31T20:37:00.000Z","updated_at":"2024-07-26T20:02:41.000Z","dependencies_parsed_at":"2024-02-25T22:45:27.485Z","dependency_job_id":null,"html_url":"https://github.com/andrew-johnson-4/BootstrapBook","commit_stats":null,"previous_names":["andrew-johnson-4/bootstrapbook"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrew-johnson-4%2FBootstrapBook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrew-johnson-4%2FBootstrapBook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrew-johnson-4%2FBootstrapBook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrew-johnson-4%2FBootstrapBook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrew-johnson-4","download_url":"https://codeload.github.com/andrew-johnson-4/BootstrapBook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241108174,"owners_count":19910978,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["book","compilers","tutorial"],"created_at":"2024-11-12T05:27:28.106Z","updated_at":"2025-02-28T05:54:08.405Z","avatar_url":"https://github.com/andrew-johnson-4.png","language":null,"readme":"# Bootstrap Book\nLearn how to Write a Compiler in 2000 Lines of Code\n\n### λ☶\n\n[This book](https://github.com/andrew-johnson-4/BootstrapBook/wiki) explains the code of the [λ☶ compiler](https://github.com/andrew-johnson-4/-) to anyone who is interested in compiler architecture or functional language compilers.\nThe code is roughly 2000 LOC in length, but it is very terse, so the explanation takes a while.\nThe generated code is in the format of GNU Assembly for legibility.\nBinary targets are just as easy to write, but harder to read.\n\n### [Chapter 1: S-Expressions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/S%E2%80%90Expressions)\n* [The S-Expression Type Signature](https://github.com/andrew-johnson-4/BootstrapBook/wiki/S%E2%80%90Expressions#the-type-signature)\n* [Why are S-Expressions Good](https://github.com/andrew-johnson-4/BootstrapBook/wiki/S%E2%80%90Expressions#why-are-s-expressions-good)\n* [How Do We Construct An S-Expression in Assembly](https://github.com/andrew-johnson-4/BootstrapBook/wiki/S%E2%80%90Expressions#how-do-we-construct-an-s-expression-in-assembly)\n* [What Common Functions Operate on S-Expressions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/S%E2%80%90Expressions#what-common-functions-operate-on-s-expressions)\n\n### [Chapter 2: Primitive Functions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Primitive-Functions)\n* [What Is a Function?](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Primitive-Functions#what-is-a-function)\n* [What Do We Expect From a Function Inside the Compiler?](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Primitive-Functions#what-do-we-expect-from-a-function-inside-the-compiler)\n* [System Calls](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Primitive-Functions#system-calls)\n* [The `print-s` Function](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Primitive-Functions#the-print-s-function)\n* [The `strlen` Function](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Primitive-Functions#the-strlen-function)\n* [The `not` Function](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Primitive-Functions#the-not-function)\n* [The `write-file` Function](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Primitive-Functions#the-write-file-function)\n* [The `load-file` Function](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Primitive-Functions#the-load-file-function)\n\n### [Chapter 3: Hello World](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Hello-World)\n* [Program Layout](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Hello-World#program-layout)\n* [Processing Argv](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Hello-World#processing-argv)\n* [Heap Allocation of Atoms](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Hello-World#heap-allocation-of-atoms)\n* [Heap Allocation of Cons Cells](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Hello-World#heap-allocation-of-cons-cells)\n\n### [Chapter 4: User-Defined Functions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/User%E2%80%90Defined-Functions)\n* [First-Order Functions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/User%E2%80%90Defined-Functions#what-does-a-first-order-function-look-like)\n* [Passing Multiple Arguments to a Function](https://github.com/andrew-johnson-4/BootstrapBook/wiki/User%E2%80%90Defined-Functions#how-are-multiple-arguments-passed-to-a-function)\n* [Higher-Order Functions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/User%E2%80%90Defined-Functions#what-do-higher-order-functions-look-like)\n\n### [Chapter 5: Tokenization](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Tokenizer)\n* [The Tokenizer Function](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Tokenizer#the-tokenizer-function)\n* [Tokenization by Example](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Tokenizer#tokenization-by-example)\n\n### [Chapter 6: Parsing](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Parser)\n* [The Abstract Syntax Tree](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Parser#the-abstract-syntax-tree)\n* [The `parse-program` Function](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Parser#the-parse-program-function)\n* [The `parse-many-expressions` Function](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Parser#the-parse-many-expressions-function)\n* [The `parse-one-expression` Function](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Parser#the-parse-one-expression-function)\n* [The `parse-lambda` Function](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Parser#the-parse-lambda-function)\n\n### [Chapter 7: Type Checking](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Type-Checking)\n* [Defining a Type Context](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Type-Checking#defining-a-type-context)\n* [Parsing a Type Definition](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Type-Checking#parsing-a-type-definition)\n* [Enumerating Inference Cases](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Type-Checking#enumerating-inference-cases)\n* [Infer Type of an Ascription](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Type-Checking#infer-type-of-an-ascription)\n* [Infer Type of a Literal](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Type-Checking#infer-type-of-a-literal)\n* [Infer Type of a Variable](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Type-Checking#infer-type-of-a-variable)\n* [Infer Type of an Application](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Type-Checking#infer-type-of-an-application)\n* [Infer Type of a Lambda](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Type-Checking#infer-type-of-a-lambda)\n\n### [Chapter 8: Code Generation](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation)\n* [The Expression Datatype](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation#the-expression-structure)\n* [The `compile-expr` Function](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation#the-compile-expr-function)\n* [Codegen `this` Expressions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation#codegen-this-expressions)\n* [Codegen `local` Expressions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation#codegen-local-expressions)\n* [Codegen `set` Expressions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation#codegen-set-expressions)\n* [Codegen `match` Expressions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation#codegen-match-expressions)\n* [Codegen `while` Expressions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation#codegen-while-expressions)\n* [Codegen `if` Expressions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation#codegen-if-expressions)\n* [Codegen Function Application Expressions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation#codegen-function-application-expressions)\n* [Codegen Literal Expressions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation#codegen-literal-expressions)\n* [Codegen `argv` Expressions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation#codegen-argv-expressions)\n* [Codegen Cons Expressions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation#codegen-cons-expressions)\n* [Codegen Nil Expressions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation#codegen-nil-expressions)\n* [Codegen Variable Expressions](https://github.com/andrew-johnson-4/BootstrapBook/wiki/Code-Generation#codegen-variable-expressions)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrew-johnson-4%2Fbootstrapbook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrew-johnson-4%2Fbootstrapbook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrew-johnson-4%2Fbootstrapbook/lists"}