{"id":21011588,"url":"https://github.com/zhuzilin/monkey","last_synced_at":"2025-05-15T03:32:24.352Z","repository":{"id":106435031,"uuid":"199131187","full_name":"zhuzilin/monkey","owner":"zhuzilin","description":"A C++ version monkey language interpreter. From Write An Interpreter In Go","archived":false,"fork":false,"pushed_at":"2020-07-14T02:21:25.000Z","size":4024,"stargazers_count":36,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T03:23:07.560Z","etag":null,"topics":["interpreter","lexer","parser","write-an-interpreter-in-go"],"latest_commit_sha":null,"homepage":null,"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/zhuzilin.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":"2019-07-27T07:19:49.000Z","updated_at":"2024-09-25T12:44:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"8b9d7b9e-4283-4cb1-b373-a99324a4241c","html_url":"https://github.com/zhuzilin/monkey","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/zhuzilin%2Fmonkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuzilin%2Fmonkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuzilin%2Fmonkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhuzilin%2Fmonkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhuzilin","download_url":"https://codeload.github.com/zhuzilin/monkey/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254266380,"owners_count":22042098,"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":["interpreter","lexer","parser","write-an-interpreter-in-go"],"created_at":"2024-11-19T09:29:39.406Z","updated_at":"2025-05-15T03:32:24.346Z","avatar_url":"https://github.com/zhuzilin.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# monkey\nA C++ version [monkey](https://monkeylang.org/) language interpreter. From [Write An Interpreter In Go](https://interpreterbook.com/).\nWith additional mark-and-sweep garbage collection.\n## Usage\nYou can use the vscode config to build and run the interpreter. Or\n```bash\n\u003e g++ -std=c++11 main.cpp src/*.cpp -o monkey --debug\n\u003e ./monkey test.mk\nhello world!\nminimal prime factor for 1321231 is 487 \n\nreturn: \ntype:  NULL\nvalue: NULL\n```\nThe `test.mk` is function to get minimal prime factor.\n```js\nprint(\"hello world!\");\n\nlet a = 1321231;\n\n// find mininum factor that is greater than 1\nlet minFactor = fn (a) {\n\tlet i = 2;\n\twhile(true) {\n\t\tif (a % i == 0) { \n\t\t\treturn i;\n\t\t}\n\t\tlet i = i + 1;\n\t}\n}\n\nlet f = minFactor(a);\n\nif (f == a) {\n\tprint(a, \"is a prime!\");\n} else {\n\tprint(\"minimal prime factor for\", a, \"is\", f);\n}\n```\nAnd `repl.cpp` is the REPL(Read-Eval-Print Loop) main function, to only use parser or lexer, you can change to `rppl.cpp` or `rlpl.cpp`.\n\n## TODOs\n* [x] Add garbage collection.\n* [x] Add array support.\n* [x] Add buildin functions.\n* [ ] Add dictionary support.\n* [ ] Add error handling for lexer.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhuzilin%2Fmonkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhuzilin%2Fmonkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhuzilin%2Fmonkey/lists"}