{"id":13779563,"url":"https://github.com/michiakig/lisp-in-c","last_synced_at":"2025-12-17T14:27:41.871Z","repository":{"id":141710588,"uuid":"1340882","full_name":"michiakig/lisp-in-c","owner":"michiakig","description":"Lisp interpreter in C and compiler to C","archived":false,"fork":false,"pushed_at":"2011-03-18T02:27:00.000Z","size":684,"stargazers_count":29,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-03T18:14:08.835Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-35.html#%_thm_5.51","language":"C","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/michiakig.png","metadata":{"files":{"readme":"README","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}},"created_at":"2011-02-08T05:12:37.000Z","updated_at":"2022-11-09T14:45:18.000Z","dependencies_parsed_at":"2023-03-12T06:45:39.309Z","dependency_job_id":null,"html_url":"https://github.com/michiakig/lisp-in-c","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michiakig%2Flisp-in-c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michiakig%2Flisp-in-c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michiakig%2Flisp-in-c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michiakig%2Flisp-in-c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michiakig","download_url":"https://codeload.github.com/michiakig/lisp-in-c/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225056716,"owners_count":17414191,"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":[],"created_at":"2024-08-03T18:01:06.480Z","updated_at":"2025-12-17T14:27:36.830Z","avatar_url":"https://github.com/michiakig.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"\"What I cannot create, I do not understand.\" -- Richard Feynman\n\nA rudimentary Lisp interpreter and compiler, inspired by the last two\nexercises of Structure and Interpretation of Computer Programs.\n\nhttp://mitpress.mit.edu/sicp/full-text/book/book-Z-H-35.html#%_thm_5.51\n\nExercise 5.51.\n\n\"Develop a rudimentary implementation of Scheme in C (or some other\nlow-level language of your choice) by translating the explicit-control\nevaluator of section 5.4 into C. In order to run this code you will\nneed to also provide appropriate storage-allocation routines and other\nrun-time support.\"\n\nExercise 5.52.\n\n\"As a counterpoint to exercise 5.51, modify the compiler so that it\ncompiles Scheme procedures into sequences of C instructions. Compile\nthe metacircular evaluator of section 4.1 to produce a Scheme\ninterpreter written in C.\"\n\nBuild\n\nRun make in the interpreter's directory. Start the interpreter's REPL with\n\n$ lispinc ./scm/repl.scm\n\nor, with no derived forms (let, cond, and, or, etc)\n\n$ lispinc ./scm/simplerepl.scm\n\nFeatures/bugs\n\nThe interpreter's reader can't handle two s-expression in one line; it\nwill ignore the second one. Primitives don't check for arity. The\ninterpreter has no tail-call optimizationm and no garbage\ncollection. There are no user-defined macros, although a macro system\nis in place for some syntactic sugar used in the compiler (let, cond,\netc) and user-defined macros would be relatively straightforward to\nadd. There is very, very little error checking. There are many, many\nmemory leaks.\n\nThe compiler is really just a translator from the register machine\nlanguage to C. It includes tail-call optimization (well the one from\nSICP does) and a naive mark-and-sweep garbage collector, which appears\nto work.\n\nLicense\n\nSince this builds and relies upon SICP, which is graciously available\nunder a Creative Commons license, this code is under the same license.\n\nhttp://creativecommons.org/licenses/by-nc/3.0/\n\nSee also:\n\nScheme from Scratch (closest to this project)\nhttp://michaux.ca/articles/scheme-from-scratch-introduction\n\nA tiny self-hosting Lisp-to-C compiler\nhttps://github.com/darius/ichbins\n\n90 Minute Scheme to C Compiler\nhttp://www.iro.umontreal.ca/~boucherd/mslug/meetings/20041020/minutes-en.html\n\nAn Incremental Approach to Compiler Construction\nhttp://scheme2006.cs.uchicago.edu/11-ghuloum.pdf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichiakig%2Flisp-in-c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichiakig%2Flisp-in-c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichiakig%2Flisp-in-c/lists"}