{"_id":"@benjeau/monkey-interpreter","_rev":"7-e274638ee168f36cf0e32687e217f50b","name":"@benjeau/monkey-interpreter","dist-tags":{"latest":"0.5.1"},"versions":{"0.1.0":{"name":"@benjeau/monkey-interpreter","version":"0.1.0","license":"MIT","_id":"@benjeau/monkey-interpreter@0.1.0","maintainers":[{"name":"benjeau","email":"benoit@jeaurond.dev"}],"dist":{"shasum":"037a9af3e591a8bf141e837758d1a33a03e27117","tarball":"https://registry.npmjs.org/@benjeau/monkey-interpreter/-/monkey-interpreter-0.1.0.tgz","fileCount":7,"integrity":"sha512-AfM/SSkyukHCqtbV6pDRbYQA1YPM/rUQBKrMEt42uE/IPiTsRjb88m+H2PPlLOOc9zBucEPWRCvtK+QGY9fvYg==","signatures":[{"sig":"MEUCIBp26nE6CIVCfgM/t2TEjrcw2mjrz/fF7vxMdCoQVzADAiEAvOgK78RnMesbgOveG/I3BqQKthYOhI9vQbD1ceEf054=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":127899},"main":"monkey_interpreter.js","type":"module","types":"monkey_interpreter.d.ts","gitHead":"648d3549e887207087ba4c977418dfb1a85c9b2d","_npmUser":{"name":"benjeau","email":"benoit@jeaurond.dev"},"repository":{"url":"https://github.com/BenJeau/@benjeau/monkey-interpreter","type":"git"},"_npmVersion":"10.8.2","description":"A simple interpreter for the monkey programming language","directories":{},"sideEffects":["./monkey_interpreter.js","./snippets/*"],"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/monkey-interpreter_0.1.0_1726094750341_0.23035436003927945","host":"s3://npm-registry-packages"}},"0.2.1":{"name":"@benjeau/monkey-interpreter","version":"0.2.1","license":"MIT","_id":"@benjeau/monkey-interpreter@0.2.1","maintainers":[{"name":"benjeau","email":"benoit@jeaurond.dev"}],"dist":{"shasum":"bee0cd249f3bda912f11e0e2d7f4cace6860247a","tarball":"https://registry.npmjs.org/@benjeau/monkey-interpreter/-/monkey-interpreter-0.2.1.tgz","fileCount":7,"integrity":"sha512-IWDyJH9FL0ZSdVuUV+X+PxQpJL23PDSkTLf02nRHr7CLE4RX8JPbtLUV1PFdEDWvXL2O20pWx5mXKwUL/IoniA==","signatures":[{"sig":"MEUCIFNRzzGsdoUCr3n4mUV6rDpx6mSWB/JFWteTdaX8fqF0AiEA0VlxPx8TJwsQVwbGCaNLCdxfpEZw31uN3i3EgY12rKc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":142646},"main":"monkey_interpreter.js","type":"module","types":"monkey_interpreter.d.ts","gitHead":"3199c607af6e31b7a3fa8ac91208dd31293b67fb","_npmUser":{"name":"benjeau","email":"benoit@jeaurond.dev"},"repository":{"url":"https://github.com/BenJeau/@benjeau/monkey-interpreter","type":"git"},"_npmVersion":"10.8.2","description":"A simple interpreter for the monkey programming language","directories":{},"sideEffects":["./monkey_interpreter.js","./snippets/*"],"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/monkey-interpreter_0.2.1_1726246495060_0.4696394138807811","host":"s3://npm-registry-packages"}},"0.2.2":{"name":"@benjeau/monkey-interpreter","version":"0.2.2","license":"MIT","_id":"@benjeau/monkey-interpreter@0.2.2","maintainers":[{"name":"benjeau","email":"benoit@jeaurond.dev"}],"dist":{"shasum":"1625acb10850cb9d02f89048f0f473cf190a915c","tarball":"https://registry.npmjs.org/@benjeau/monkey-interpreter/-/monkey-interpreter-0.2.2.tgz","fileCount":7,"integrity":"sha512-9X5SOvfziPexLfWZoCNtRAbd0vpB+jrh0wpJ1AVMobERKhiD+G4RItem+BJpvoJSV6flwJOb6TYDpi3KHePlaA==","signatures":[{"sig":"MEYCIQDIptSyqnA307A0UVyFamhfepoaD3T5AKZibi4wvuqcIgIhAMBBz2opIWDN8yDUTzDbuJUDtcscXTv9bp06r+eW5eNT","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":142786},"main":"monkey_interpreter.js","type":"module","types":"monkey_interpreter.d.ts","gitHead":"1a0883dfa32d87a56306e8afc4abfa8b31157179","_npmUser":{"name":"benjeau","email":"benoit@jeaurond.dev"},"repository":{"url":"https://github.com/BenJeau/@benjeau/monkey-interpreter","type":"git"},"_npmVersion":"10.8.2","description":"A simple interpreter for the monkey programming language","directories":{},"sideEffects":["./monkey_interpreter.js","./snippets/*"],"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/monkey-interpreter_0.2.2_1726252951779_0.03981863666116503","host":"s3://npm-registry-packages"}},"0.3.0":{"name":"@benjeau/monkey-interpreter","version":"0.3.0","license":"MIT","_id":"@benjeau/monkey-interpreter@0.3.0","maintainers":[{"name":"benjeau","email":"benoit@jeaurond.dev"}],"dist":{"shasum":"5905b3cd9fe9c224329e45fbd78ed352c967f0f1","tarball":"https://registry.npmjs.org/@benjeau/monkey-interpreter/-/monkey-interpreter-0.3.0.tgz","fileCount":7,"integrity":"sha512-SGlqzLXBiwwE0uLdp2WfEqYqC9dX5+J8SzuXAL07fJbkgsUw8aM1Is7LV3jZNJPbiRvherJVPMXZ4RLihu5icQ==","signatures":[{"sig":"MEUCIQCEmcFVGqfhOsbVJBtrHKNDBZvYvpNZq6yRvUiXQqgGNAIgbkepb1+B9P9soet826rvcukNzkF7ndH/R6TL15mpDtQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":168163},"main":"monkey_interpreter.js","type":"module","types":"monkey_interpreter.d.ts","gitHead":"b211cc1d4ec7fa466273385ec451c9c95c7aedfb","_npmUser":{"name":"benjeau","email":"benoit@jeaurond.dev"},"repository":{"url":"https://github.com/BenJeau/@benjeau/monkey-interpreter","type":"git"},"_npmVersion":"10.8.2","description":"A simple interpreter for the monkey programming language","directories":{},"sideEffects":["./monkey_interpreter.js","./snippets/*"],"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/monkey-interpreter_0.3.0_1726256534074_0.17820733733671146","host":"s3://npm-registry-packages"}},"0.4.0":{"name":"@benjeau/monkey-interpreter","version":"0.4.0","license":"MIT","_id":"@benjeau/monkey-interpreter@0.4.0","maintainers":[{"name":"benjeau","email":"benoit@jeaurond.dev"}],"dist":{"shasum":"643f3700f9b1673b1535e82503c33df4459cc9e6","tarball":"https://registry.npmjs.org/@benjeau/monkey-interpreter/-/monkey-interpreter-0.4.0.tgz","fileCount":7,"integrity":"sha512-C9GJQlz53PSoKDEujmJxdrsSuAKLhROWbh2Bj/r7HJkh6A6StBDMp+UnIAw76oE2asoGm8VTEkqwF3hngGkSTg==","signatures":[{"sig":"MEYCIQDii23qRWxHuAxIJl5CXkfA3s+r3yZ2zp2eVi642NjCWgIhAIE3vtMM3T1kIoUaKRxUzUUTocUdoplB3PJ7c4ouffrx","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":191477},"main":"monkey_interpreter.js","type":"module","types":"monkey_interpreter.d.ts","gitHead":"d835be92f7640073e7c1458ae1673226199d33b4","_npmUser":{"name":"benjeau","email":"benoit@jeaurond.dev"},"repository":{"url":"https://github.com/BenJeau/@benjeau/monkey-interpreter","type":"git"},"_npmVersion":"10.8.2","description":"A simple interpreter for the monkey programming language","directories":{},"sideEffects":["./monkey_interpreter.js","./snippets/*"],"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/monkey-interpreter_0.4.0_1726261925801_0.1132257665173706","host":"s3://npm-registry-packages"}},"0.4.1":{"name":"@benjeau/monkey-interpreter","version":"0.4.1","license":"MIT","_id":"@benjeau/monkey-interpreter@0.4.1","maintainers":[{"name":"benjeau","email":"benoit@jeaurond.dev"}],"dist":{"shasum":"10b2b6defd2963ee08267ee390b1f14e5f10f966","tarball":"https://registry.npmjs.org/@benjeau/monkey-interpreter/-/monkey-interpreter-0.4.1.tgz","fileCount":7,"integrity":"sha512-Q0q7UPpeSVIBlUVaJwF8jtrjyaupGSyDBQ+LyKU/sBLAY+aU+fYwS7ObQIac3hy1JH7xCfimzQlWWlZiXTwt0Q==","signatures":[{"sig":"MEUCIGzQcEiQ0XJZAbRNle2H3visbksuSp35n5OkNKhXcDafAiEA7mNzCRofmcRgTgRUWYn/Yz62XLgKFpsrE0u5QbHPaBI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":192635},"main":"monkey_interpreter.js","type":"module","types":"monkey_interpreter.d.ts","gitHead":"251edc920fa9aaab30ba263b9872918a224fc699","_npmUser":{"name":"benjeau","email":"benoit@jeaurond.dev"},"repository":{"url":"https://github.com/BenJeau/@benjeau/monkey-interpreter","type":"git"},"_npmVersion":"10.8.2","description":"A simple interpreter for the monkey programming language","directories":{},"sideEffects":["./monkey_interpreter.js","./snippets/*"],"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/monkey-interpreter_0.4.1_1726262760726_0.7069253763179058","host":"s3://npm-registry-packages"}},"0.5.0":{"name":"@benjeau/monkey-interpreter","version":"0.5.0","license":"MIT","_id":"@benjeau/monkey-interpreter@0.5.0","maintainers":[{"name":"benjeau","email":"benoit@jeaurond.dev"}],"dist":{"shasum":"5d73fea5c6ff917a87f2f190a50f0669d18bf2f5","tarball":"https://registry.npmjs.org/@benjeau/monkey-interpreter/-/monkey-interpreter-0.5.0.tgz","fileCount":7,"integrity":"sha512-IxUXo65aulp9d6t03kbmAqE2ovRIOutrrFeIGCORTWZlp+697qVsFM4nZq7radhK3KAPV7gvWWCUWqQMlAfTLQ==","signatures":[{"sig":"MEYCIQDQ3onRkxYCzDuDmzOaBm+i2nwUFUi/5FKiNevkJSs6MwIhAO90ap+gWKrUd/kiOdoWyzHRqwtfkDQ6KttX3QFfzTNJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":200606},"main":"monkey_interpreter.js","type":"module","types":"monkey_interpreter.d.ts","gitHead":"c1f25ab13c71e4429ed237d312169489136d49e1","_npmUser":{"name":"benjeau","email":"benoit@jeaurond.dev"},"repository":{"url":"https://github.com/BenJeau/@benjeau/monkey-interpreter","type":"git"},"_npmVersion":"10.8.2","description":"A simple interpreter for the monkey programming language","directories":{},"sideEffects":["./monkey_interpreter.js","./snippets/*"],"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/monkey-interpreter_0.5.0_1726422586573_0.2510534697808493","host":"s3://npm-registry-packages"}},"0.5.1":{"name":"@benjeau/monkey-interpreter","type":"module","description":"A simple interpreter for the monkey programming language","version":"0.5.1","license":"MIT","repository":{"type":"git","url":"https://github.com/BenJeau/@benjeau/monkey-interpreter"},"main":"monkey_interpreter.js","types":"monkey_interpreter.d.ts","sideEffects":["./monkey_interpreter.js","./snippets/*"],"_id":"@benjeau/monkey-interpreter@0.5.1","gitHead":"017762d38ac5f8a38328b6b76012d3073a44678a","_nodeVersion":"20.17.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-724oH8ll4FmyAySNAemUdnpF9vky/4EFWKPIEQrVRAEW7arYZqIvxnHKZB1+ISv1bHqerCaSGMWXQqN9w3zIpw==","shasum":"d5170be2dc972eabb1bf54d3c2a78917a867d164","tarball":"https://registry.npmjs.org/@benjeau/monkey-interpreter/-/monkey-interpreter-0.5.1.tgz","fileCount":7,"unpackedSize":153028,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD3oEdnxCVPyHC9UFl5KvS9mw+ZWUZzhiHz3+tN7mYzfwIgA6dedsXUbSSoIo7DOcsuuDj/NrCHLK7pZJkXeSonvsw="}]},"_npmUser":{"name":"benjeau","email":"benoit@jeaurond.dev"},"directories":{},"maintainers":[{"name":"benjeau","email":"benoit@jeaurond.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/monkey-interpreter_0.5.1_1728435245621_0.8503681599039967"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-11T22:45:50.239Z","modified":"2024-10-09T00:54:06.079Z","0.1.0":"2024-09-11T22:45:50.558Z","0.2.1":"2024-09-13T16:54:55.258Z","0.2.2":"2024-09-13T18:42:31.970Z","0.3.0":"2024-09-13T19:42:14.226Z","0.4.0":"2024-09-13T21:12:05.984Z","0.4.1":"2024-09-13T21:26:00.945Z","0.5.0":"2024-09-15T17:49:46.805Z","0.5.1":"2024-10-09T00:54:05.894Z"},"license":"MIT","repository":{"type":"git","url":"https://github.com/BenJeau/@benjeau/monkey-interpreter"},"description":"A simple interpreter for the monkey programming language","maintainers":[{"name":"benjeau","email":"benoit@jeaurond.dev"}],"readme":"# monkey-interpreter\n\nAn interpreter for the monkey programming language written in Rust without external dependencies/crates. The content of this repository is based on the book [Writing an Interpreter in Go](https://interpreterbook.com/) by Thorsten Ball, but instead of implenting it in Go, I've decided to use Rust for the following reasons:\n\n- Rust has sum types, which remove the need of interfaces and dynamic dispatch as shown in the book\n- Rust has pattern matching, which makes the code more concise and readable\n- Rust can compile to WebAssembly, which makes it possible to run the interpreter in the browser (which I used to create a small demo)\n- Rust has a great testing framework, which makes it easy to write unit tests\n- Lastly, I love Rust 🦀\n\n## Usage\n\n### WebAssembly\n\n[![Build status](https://github.com/BenJeau/monkey-interpreter/actions/workflows/release.yaml/badge.svg?branch=main)](https://github.com/BenJeau/monkey-interpreter/actions/workflows/release.yaml)\n[![NPM Version](https://img.shields.io/npm/v/@benjeau/monkey-interpreter)](https://www.npmjs.com/package/@benjeau/monkey-interpreter)\n\nThe interpreter can also be compiled to WebAssembly, which makes it possible to run it in the browser. A small demo is available at [https://monkey-interpreter.jeaurond.dev/](https://monkey-interpreter.jeaurond.dev/).\n\nYou can install the npm package `@benjeau/monkey-interpreter` by running the following command:\n\n```bash\nnpm install @benjeau/monkey-interpreter\n```\n\nThen, you can use the interpreter in your TypeScript/JavaScript code like this:\n\n```javascript\nimport { execute, lexer } from '@benjeau/monkey-interpreter';\n\nconst program = `\nlet add = fn(x, y) {\n    x + y;\n};\n\nlet result = add(5, 10);\n`;\n\nconst tokens = lexer(program); // Returns an array of tokens\nconst result = execute(program); // Returns the result of the program\n```\n\nFor more details, please refer to the types from within the package.\n\n#### Compilation\n\nTo compile the interpreter to WebAssembly, you need to install [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/) and run the following command:\n\n```bash\nwasm-pack build --target bundler\n```\n\nThis will generate a `pkg` directory with the compiled WebAssembly files.\n\n### Rust\n\nTo install and use the interpreter, you can use the following command after cloning the repository:\n\n```bash\ncargo run\n```\n\nThis will start the REPL, where you can enter your code and see the output.\n","readmeFilename":"README.md"}