{"id":17624898,"url":"https://github.com/thrashr888/monkey-typescript","last_synced_at":"2025-05-05T02:56:30.928Z","repository":{"id":34693326,"uuid":"175556054","full_name":"thrashr888/monkey-typescript","owner":"thrashr888","description":"An interpreted language for the browser and NodeJS, based on Monkey","archived":false,"fork":false,"pushed_at":"2022-12-03T04:55:07.000Z","size":402,"stargazers_count":11,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T19:13:40.029Z","etag":null,"topics":["browser","interpreter","javascript","language","monkey","nodejs","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/thrashr888.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}},"created_at":"2019-03-14T05:44:10.000Z","updated_at":"2025-01-19T23:29:10.000Z","dependencies_parsed_at":"2023-01-15T08:36:10.976Z","dependency_job_id":null,"html_url":"https://github.com/thrashr888/monkey-typescript","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thrashr888%2Fmonkey-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thrashr888%2Fmonkey-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thrashr888%2Fmonkey-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thrashr888%2Fmonkey-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thrashr888","download_url":"https://codeload.github.com/thrashr888/monkey-typescript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252429928,"owners_count":21746571,"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":["browser","interpreter","javascript","language","monkey","nodejs","typescript"],"created_at":"2024-10-22T22:06:21.968Z","updated_at":"2025-05-05T02:56:30.914Z","avatar_url":"https://github.com/thrashr888.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Monkey\n\nAn extended [Monkey](https://interpreterbook.com/) language interpreter in Typescript.\n\n## The Extended Monkey Language\n\nIn `example.monkey`:\n\n```javascript\nlet log = function(msg) {\n  sprint(msg);\n  true;\n};\nlet and = function(a, b) {\n  if (a) {\n    if (b) {\n      return true;\n    }\n    return false;\n  }\n  return false;\n};\nlet or = function(a, b) {\n  if (a) {\n    return true;\n  }\n  if (b) {\n    return true;\n  }\n  return false;\n};\n\nlog(0);\n\nlet a = '1';\nlog(a);\n\nlet b = [1, 2, 'three'];\nlog(b[1]);\n\nlet c = { a: 'bee', c: 'three' };\nlog(c['c']); // three\n\nand(1, false); // false\nor(1, false); // true\n```\n\n    $ npx monkey-typescript examples/example.monkey\n    Log: 0\n    Log: 1\n    Log: 2\n    Log: three\n    null\n\n## REPL\n\n    $ npx monkey-typescript\n    Hello thrashr888! This is the Monkey programming language!\n    Feel free to type in commands\n    \u003e\u003e\n\n    $ docker run -it thrashr888/monkey-typescript\n    Hello root! This is the Monkey programming language!\n    Feel free to type in commands\n    \u003e\u003e\n\n## Usage\n\n    $ npm install monkey-typescript\n\n```typescript\nimport { NewEnvironment, Lexer, Parser, Eval } from 'monkey-typescript';\n\nlet env = NewEnvironment();\nlet l = new Lexer('sprint(\"hello!\"); let a = 5; 5 * 55;');\nlet p = new Parser(l);\nlet program = p.ParseProgram();\n\nif (p.Errors().length !== 0) {\n  console.log(p.Errors().forEach(msg =\u003e console.log(`\\t${msg}`)));\n  return;\n}\n\nlet evaluated = Eval(program, env);\nconsole.log(evaluated.Inspect());\n```\n\nUsing `require`:\n\n```javascript\nvar monkeyTypescript = require('monkey-typescript');\n\nlet env = monkeyTypescript.NewEnvironment();\nlet l = new monkeyTypescript.Lexer('sprint(\"hello!\"); let a = 5; 5 * 55;');\nlet p = new monkeyTypescript.Parser(l);\nlet program = p.ParseProgram();\n\nif (p.Errors().length !== 0) {\n  console.log(p.Errors().forEach(msg =\u003e console.log(`\\t${msg}`)));\n  return;\n}\n\nlet evaluated = monkeyTypescript.Eval(program, env);\nconsole.log(evaluated.Inspect());\n```\n\n## Development\n\nContributions welcome!\n\n### Build\n\n    $ nvm use\n    $ npm install\n\n### Run\n\n    $ npm start\n\nor:\n\n    $ ts-node index.ts\n\n### Test\n\n    $ npm run test\n\nor watch for file changes:\n\n    $ npm run test:live\n\n## Publish\n\n    # bump version number in `package.json`\n    # bump version number in `Dockerfile`\n    # commit and push changes\n    $ git commit -m'bump version to v0.2.0'\n    $ git push\n    $ npm run build\n    $ npm publish\n    $ git tag v0.2.0\n    $ git push origin v0.2.0\n\n## Credits\n\nOriginal Monkey language and source code from the book [\"Writing an Interpreter\nin Go\" by Thorsten Ball](https://interpreterbook.com/). Translated to Typescript\nby Paul Thrasher. It's a great book. Buy it!\n\n## Typescript Interpreter and Extensions MIT LICENSE\n\nCopyright (c) 2019 Paul Thrasher\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n## Monkey Language and Go Interpreter MIT LICENSE\n\nCopyright (c) 2016-2017 Thorsten Ball\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthrashr888%2Fmonkey-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthrashr888%2Fmonkey-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthrashr888%2Fmonkey-typescript/lists"}