{"id":13782931,"url":"https://github.com/rbaron/scam","last_synced_at":"2026-05-29T02:31:28.216Z","repository":{"id":145736299,"uuid":"69509205","full_name":"rbaron/scam","owner":"rbaron","description":"A toy Lisp interpreter in C","archived":false,"fork":false,"pushed_at":"2016-09-30T22:29:21.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-24T16:14:52.890Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/rbaron.png","metadata":{"files":{"readme":"README.md","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}},"created_at":"2016-09-28T22:36:55.000Z","updated_at":"2019-01-03T19:43:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"f2ad998c-7520-4114-892b-2c4cdcf861ed","html_url":"https://github.com/rbaron/scam","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/rbaron%2Fscam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaron%2Fscam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaron%2Fscam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaron%2Fscam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rbaron","download_url":"https://codeload.github.com/rbaron/scam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213838115,"owners_count":15645779,"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:48.403Z","updated_at":"2025-12-24T04:24:54.454Z","avatar_url":"https://github.com/rbaron.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# scam\n\nscam is a toy/minimalistic Lisp interpreter written in C.\n\n\n## Status\n\nLacking critical features:\n\n- Garbage collection;\n- String manipulation primitives;\n- Tail recursion optimization;\n\n\n## Compiling\n\n```bash\n$ make\n```\n\n## Examples\n\nCode is read from stdin. The `examples.scam` file is interpretable. You can run it with `cat examples.scam | ./scam`. Here it is:\n\n```lisp\n;\n; Types\n;\n\n; Numeric\n42\n; =\u003e NUMBER 42.000000\n\n; String\n\"Hello, world\"\n; =\u003e STRING Hello, world\n\n; Boolean\ntrue\n; =\u003e BOOLEAN 1\n\nfalse\n; =\u003e BOOLEAN 0\n\n;\n; Numeric primitive operators\n;\n\n(+ 1 2)\n; =\u003e NUMBER 3.000000\n\n(* 2 (- 1 2) (/ 2 2))\n; =\u003e NUMBER -2.000000\n\n;\n; Numeric primitive predicates\n;\n\n(== 1 2)\n; =\u003e BOOLEAN 0\n\n(\u003e 2 1)\n; =\u003e BOOLEAN 1\n\n(\u003c 1 2)\n; =\u003e BOOLEAN 0\n\n;\n; User defined procedures\n;\n\n(define factorial (lambda (n)\n  (if (== n 1)\n    1\n    (* n (factorial (- n 1))))))\n; =\u003e USER DEFINED PROCEDURE WITH ARGS n,\n\n;\n; I/O\n;\n\n(display \"6! = \" (factorial 6))\n; 6! = 720.000000\n; =\u003e BOOLEAN 1\n\n(display \"This is a number: \" 1 \" and this is another: \" 2)\n; This is a number: 1.000000 and this is another: 2.000000\n; =\u003e BOOLEAN 1\n\n```\n\n\n## Debugging\n\nYou can add a `--debug` switch to add debug information to the output. E.g.:\n\n- `fib.scam` - Evaluates the 8th Fibonacci number\n```\n$ cat fib.scam | ./scam\n=\u003e NUMBER 21.000000\n```\n\n```\n$ cat fib.scam | ./scam --debug\nTOKENS (45)\n==========\n(, begin, (, define, fib, (, lambda, (, n, ), (, if, (, \u003c, n, 3, ), 1, (, +, (, fib, (, -, n, 1, ), ), (, fib, (, -, n, 2, ), ), ), ), ), ), (, fib, 8, ), ),\n\nAST:\n====\nCOMPOUND\n    SYMBOL begin\n    COMPOUND\n        SYMBOL define\n        SYMBOL fib\n        COMPOUND\n            SYMBOL lambda\n            COMPOUND\n                SYMBOL n\n            COMPOUND\n                SYMBOL if\n                COMPOUND\n                    SYMBOL \u003c\n                    SYMBOL n\n                    NUMBER 3.000000\n                NUMBER 1.000000\n                COMPOUND\n                    SYMBOL +\n                    COMPOUND\n                        SYMBOL fib\n                        COMPOUND\n                            SYMBOL -\n                            SYMBOL n\n                            NUMBER 1.000000\n                    COMPOUND\n                        SYMBOL fib\n                        COMPOUND\n                            SYMBOL -\n                            SYMBOL n\n                            NUMBER 2.000000\n    COMPOUND\n        SYMBOL fib\n        NUMBER 8.000000\n\nENV:\n====\nfib =\u003e USER DEFINED PROCEDURE WITH ARGS n,\n\u003c =\u003e PRIMITIVE PROCEDURE\n\u003e =\u003e PRIMITIVE PROCEDURE\n== =\u003e PRIMITIVE PROCEDURE\n/ =\u003e PRIMITIVE PROCEDURE\n* =\u003e PRIMITIVE PROCEDURE\n- =\u003e PRIMITIVE PROCEDURE\n+ =\u003e PRIMITIVE PROCEDURE\ntrue =\u003e BOOLEAN 1\nfalse =\u003e BOOLEAN 0\n\nRESULT:\n=======\n=\u003e NUMBER 21.000000\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbaron%2Fscam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frbaron%2Fscam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbaron%2Fscam/lists"}