{"id":13439784,"url":"https://github.com/carld/micro-lisp","last_synced_at":"2025-03-20T09:30:39.977Z","repository":{"id":71340503,"uuid":"109558666","full_name":"carld/micro-lisp","owner":"carld","description":"🎄A very small Lisp programming language 😀that used to be under 200 lines of C🎄","archived":true,"fork":false,"pushed_at":"2019-12-13T08:59:32.000Z","size":76,"stargazers_count":792,"open_issues_count":2,"forks_count":72,"subscribers_count":26,"default_branch":"master","last_synced_at":"2024-08-01T03:29:54.843Z","etag":null,"topics":["c","lisp","micro","scheme","small","tiny"],"latest_commit_sha":null,"homepage":"","language":"C","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/carld.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}},"created_at":"2017-11-05T07:01:10.000Z","updated_at":"2024-07-22T06:10:16.000Z","dependencies_parsed_at":"2023-02-28T20:45:41.586Z","dependency_job_id":null,"html_url":"https://github.com/carld/micro-lisp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carld%2Fmicro-lisp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carld%2Fmicro-lisp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carld%2Fmicro-lisp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carld%2Fmicro-lisp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carld","download_url":"https://codeload.github.com/carld/micro-lisp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221745184,"owners_count":16873733,"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":["c","lisp","micro","scheme","small","tiny"],"created_at":"2024-07-31T03:01:17.054Z","updated_at":"2024-10-27T23:30:14.444Z","avatar_url":"https://github.com/carld.png","language":"C","readme":"### Micro Lisp\n\nObjective: implement a small Lisp/Scheme language in as little C code as possible.\n\n_This is a hobby project for educational purposes, it has bugs and may fail without warning. Pull requests and improvements welcome_\n\nThe interpreter supports `lambda`, e.g.\n\n```lisp\n  ((lambda (x) (cons x (quote 1))) (quote 7))\n  (7 . 1)\n```\n\nNote that `lambda` does not capture free variables (variables that are not passed as arguments and refer to an outer scope). Free variables will resolve to their assigned values in the environment when the body of the lambda is evaluated.\n\nThe special forms `if` and `quote` behave in a typical way:\n\n```lisp\n  (if (quote t) (quote 7) (quote 0))\n  7\n```\n\nThe only types are symbols and pairs.\n\nNon-quoted symbols are looked up in the environment. If they have no associated\nvalue the result is `null`; in fact, zero. Because there is no numeric type a \nnumber e.g. `7` will be treated like any other symbol and looked up in the environment. \nNote in the examples above how numbers are quoted to prevent that.\n\nThe built-in primitives in the environment are: `car`, `cdr`, `cons`, `eq?`,\n`pair?`, `read`, `write`.\n\nAlso provided is `apply` which takes a function and a single list argument:\n\n```lisp\n  (apply write (quote ((hello world))))\n  (hello world)\n  (quote t)\n```\n\nLists can be built up by `cons`ing:\n\n```lisp\n  (apply write (cons (cons (quote hello) (cons (quote world) null)) null))\n  (hello world)\n  (quote t)\n```\n\n### Read Eval Print Loop\n\nA REPL is implemented in micro-lisp itself. To try it out in a terminal:\n\n```\n  cat repl.lisp - | ./micro-lisp\n```\n\nTo exit, press 'control c' to terminate the process.\n\nNote the `-` argument to `cat` to pipe stdin through, otherwise micro-lisp will receive end-of-file.\n\nThe source code for the REPL is in `repl.lisp`. It implements `eval` and provides an environment which resolves symbols to the primitive functions in the underlying micro-lisp interpreter.\n\n### Debugging with GDB\n\nA `.gdbinit` file sets the target, breakpoints and runs the executable. Simply run `gdb`.\n\n\nPull requests welcome.\n\n[![asciicast](https://asciinema.org/a/HbNmch4GVH9jXpeY3I6yvfqPF.png)](https://asciinema.org/a/HbNmch4GVH9jXpeY3I6yvfqPF?autoplay=1)\n\n","funding_links":[],"categories":["C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarld%2Fmicro-lisp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarld%2Fmicro-lisp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarld%2Fmicro-lisp/lists"}