{"_id":"@boenfu/tsmonkey","name":"@boenfu/tsmonkey","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@boenfu/tsmonkey","version":"0.1.0","description":"```bash npm install @boenfu/tsmonkey ```","author":{"name":"boenfu"},"license":"MIT","homepage":"https://github.com/boenfu/tsmonkey#readme","repository":{"type":"git","url":"git+https://github.com/boenfu/tsmonkey.git"},"bugs":{"url":"https://github.com/boenfu/tsmonkey/issues"},"main":"index.ts","module":"index.ts","types":"index.ts","dependencies":{"typescript":"^5.5.3"},"devDependencies":{"@antfu/eslint-config":"^2.24.1","eslint":"^9.8.0"},"publishConfig":{"access":"public"},"gitHead":"d564897f9520a97ddfc87fc1036bee6bf454e072","_id":"@boenfu/tsmonkey@0.1.0","_nodeVersion":"16.19.1","_npmVersion":"8.19.3","dist":{"integrity":"sha512-yxO/EIVwDIACFvjs61DlOeXd4+Joj+k99dLSrFGf/Ck7sm86rnxpMkdHA9ftN3DGPDEm+Gsp/2HYXvnbnI/8bA==","shasum":"cdf9fe6f2502fc3c7da7405c199e326d4e33fc20","tarball":"https://registry.npmjs.org/@boenfu/tsmonkey/-/tsmonkey-0.1.0.tgz","fileCount":12,"unpackedSize":32805,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICcCAGuBNfE49H9+H9JyRrIi7RMLWFBbSxQdoZFi52exAiAVYdFZcJkjeF3uIxaBqX/wdMaxjvorbs8DZXJr9X3eDw=="}]},"_npmUser":{"name":"boenfu","email":"1997@boenfu.cn"},"directories":{},"maintainers":[{"name":"boenfu","email":"1997@boenfu.cn"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tsmonkey_0.1.0_1722656608941_0.9011195873343103"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-03T03:43:28.866Z","0.1.0":"2024-08-03T03:43:29.086Z","modified":"2024-08-03T03:43:29.390Z"},"maintainers":[{"name":"boenfu","email":"1997@boenfu.cn"}],"description":"```bash npm install @boenfu/tsmonkey ```","homepage":"https://github.com/boenfu/tsmonkey#readme","repository":{"type":"git","url":"git+https://github.com/boenfu/tsmonkey.git"},"author":{"name":"boenfu"},"bugs":{"url":"https://github.com/boenfu/tsmonkey/issues"},"license":"MIT","readme":"## 🐒 TSMonkey\n\n```bash\nnpm install @boenfu/tsmonkey\n```\n\n### Eval\n```typescript\nimport type { Eval } from '@boenfu/tsmonkey'\n\nEval<'4 + 8'> // 12\nEval<'2 * (4 + 8)'> // 24\nEval<'!99'> // false\n\nEval<'(3 + 2) * 5 == 25'> // true\nEval<'(3 > 2) != (2 > 3)'> // true\n\nEval<'7 && 9'> // 9\nEval<'false || 0'> // 0\n```\n\nvariable declaration\n```typescript\nEval<`\nlet a = 2\nlet b = 3\nlet c = a * b\nc * c\n`> // 36\n```\n\nif else\n```typescript\nEval<`\nlet a = 2\nlet b = 3\n\nif(a >= b) {\n  return \"a is greater than b\"\n} else {\n  return \"a is less than b\"\n}\n`> // \"a is less than b\"\n```\n\nfunction\n```typescript\nEval<`\nlet a = 5\nlet b = 10\n\nfunction foo(a, b) {\n  return a - b\n}\n\nfoo(b, a)\n`> // 5\n```\n\nfibonacci\n```typescript\nEval<`\nfunction fibonacci(n) {\n  if (n < 2) { return 0 }\n  if (n == 2) { return 1 }\n\n  return fibonacci(n-1) + fibonacci(n - 2)\n}\n\nfibonacci(6)\n`> // 5\n```\n### Parser\n```typescript\nimport type { Parser } from '@boenfu/tsmonkey'\nParser<'let a = \"如果你要写年\"'>\n// Program<[LetStatement<Identifier<\"a\">, StringLiteral<\"如果你要写年\">>]>\n```\n\n### Lexer\n```typescript\nimport type { Lexer } from '@boenfu/tsmonkey'\nLexer<'let a = \"如果你要写年\"'>\n// [\n//   Token<TokenType.LET, \"let\">,\n//   Token<TokenType.IDENT, \"a\">,\n//   Token<TokenType.ASSIGN, \"=\">,\n//   Token<TokenType.STRING, \"如果你要写年\">,\n//   Token<TokenType.EOF, \"\">\n// ]\n```\n\n<a href=\"https://weread.qq.com/web/bookDetail/74d32120813ab6de0g019b0e\" target=\"_blank\"><img src=\"https://cdn.weread.qq.com/web/wrweb-next/_nuxt/img_logo.Egsq9YBR.png\" height=\"18\" /></a>\n","readmeFilename":"README.md"}