{"id":22830875,"url":"https://github.com/mantoufan/yzhanjsinterpreter","last_synced_at":"2026-03-11T15:02:07.035Z","repository":{"id":171662382,"uuid":"630491723","full_name":"mantoufan/yzhanJSInterpreter","owner":"mantoufan","description":"A JavaScript Interpreter Using JS itself. JavaScript 解释器，包含词法分析、语法解析和执行。基于 LR 实现 eval","archived":false,"fork":false,"pushed_at":"2023-09-03T15:17:56.000Z","size":170,"stargazers_count":198,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-27T12:26:04.004Z","etag":null,"topics":["interpreter","js-interpreter","lexical-analyzer","syntax-parser"],"latest_commit_sha":null,"homepage":"https://mantoufan.github.io/yzhanJSInterpreter/","language":"JavaScript","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/mantoufan.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":"2023-04-20T13:51:21.000Z","updated_at":"2025-09-14T20:03:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"3cdbdbcc-0682-482d-873e-1a4cfe09eea9","html_url":"https://github.com/mantoufan/yzhanJSInterpreter","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"18a77b936e64449bf9bae86814cd7d1e05914140"},"previous_names":["mantoufan/yzhantool","mantoufan/yzhanjsinterpreter"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mantoufan/yzhanJSInterpreter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mantoufan%2FyzhanJSInterpreter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mantoufan%2FyzhanJSInterpreter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mantoufan%2FyzhanJSInterpreter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mantoufan%2FyzhanJSInterpreter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mantoufan","download_url":"https://codeload.github.com/mantoufan/yzhanJSInterpreter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mantoufan%2FyzhanJSInterpreter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30385030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T14:10:17.325Z","status":"ssl_error","status_checked_at":"2026-03-11T14:09:37.934Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","js-interpreter","lexical-analyzer","syntax-parser"],"created_at":"2024-12-12T20:15:47.862Z","updated_at":"2026-03-11T15:02:07.014Z","avatar_url":"https://github.com/mantoufan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yzhanJSInterpreter  \n[![npm](https://img.shields.io/npm/v/yzhanjsinterpreter)](https://www.npmjs.com/package/yzhanjsinterpreter)\n[![npm](https://img.shields.io/npm/dt/yzhanjsinterpreter)](https://www.npmjs.com/package/yzhanjsinterpreter)\n[![GitHub license](https://img.shields.io/github/license/mantoufan/yzhanjsinterpreter)](https://github.com/mantoufan/yzhanjsinterpreter/blob/main/LICENSE)  \nA JavaScript Interpreter Using JS itself, implement `eval`  \nJavaScript 解释器，包含词法分析、语法解析和执行。实现 `eval`\n## Demo\nYou could change JavaScript Code and view the result in realtime.  \n[Online Demo](https://mantoufan.github.io/yzhanJSInterpreter)  \n![DEMO PNG](https://s2.loli.net/2023/06/15/lwu5Cat9gox27dR.png)\n## Setup\n### Node.js\n```javascript\nnpm i yzhanjsinterpreter\nimport yzhanJSInterpreter from 'yzhanjsinterpreter'\n```\n### Browser\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/yzhanjsinterpreter@latest/docs/yzhanjsinterpreter.min.js\"\u003e\u003c/script\u003e\n```\n## Usage\n### Declaration Code\n```javascript\nconst code = `let a = 1;\nlet b = 1;\na \u003c\u003c= b++;\nfor (let i = 0; i \u003c 10; i++) {\n  if (i % 2 === 0) continue;\n  if ((i | 2) == '11') break;\n  a++;\n}\nundefined \u0026\u0026 1 ?? (0 || a + b);`\n```\n### Eval · Evaluate\n`eval` is a reserved keyword, so use `evaluate` instead\n```javascript \nconst evalResult = yzhanJSInterpreter.evaluate(code)\n```\n`evaluate` runs followed 3 steps:\n#### 1. Lexical Analyzer\n```javascript\nconst lexResult = yzhanJSInterpreter.lex(code)\n```\n#### 2. Syntax Parser\n```javascript\nconst parseResults = yzhanJSInterpreter.parse(lexResult)\n```\n#### 3. Executor\n```javascript\nconst executeResult = yzhanJSInterpreter.execute(parseResults[0])\nconst evalResult = executeResult\n```\n## Development\n### Unit Testing\n```shell\nnpm test\n```\n### Build\n```shell\nnpm run build\n```\n### Preview\n```shell\nnpm run dev\n```\n## Todo\n1. Travese AST, using child to replace the parent when there is only one parent Node.  \n2. Treeshaking: earse unseded declarations.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmantoufan%2Fyzhanjsinterpreter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmantoufan%2Fyzhanjsinterpreter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmantoufan%2Fyzhanjsinterpreter/lists"}