{"id":21438234,"url":"https://github.com/bpetermann/ts-compiler","last_synced_at":"2026-05-05T08:38:15.307Z","repository":{"id":218113232,"uuid":"742963737","full_name":"bpetermann/ts-compiler","owner":"bpetermann","description":" A typescript compiler ","archived":false,"fork":false,"pushed_at":"2024-06-25T13:37:03.000Z","size":208,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-16T23:43:10.829Z","etag":null,"topics":["compiler","jest","lexer","nodejs","parser","typescript","virtual-machine"],"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/bpetermann.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-13T22:18:11.000Z","updated_at":"2024-06-27T07:33:24.000Z","dependencies_parsed_at":"2024-03-15T14:48:28.332Z","dependency_job_id":"2c06ec53-b10b-4ed0-bac0-1a9fc0ca70bf","html_url":"https://github.com/bpetermann/ts-compiler","commit_stats":null,"previous_names":["bpetermann/ts-compiler"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bpetermann/ts-compiler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpetermann%2Fts-compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpetermann%2Fts-compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpetermann%2Fts-compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpetermann%2Fts-compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bpetermann","download_url":"https://codeload.github.com/bpetermann/ts-compiler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpetermann%2Fts-compiler/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266235565,"owners_count":23897182,"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":["compiler","jest","lexer","nodejs","parser","typescript","virtual-machine"],"created_at":"2024-11-23T00:34:15.080Z","updated_at":"2026-05-05T08:38:10.262Z","avatar_url":"https://github.com/bpetermann.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TypeScript Compiler\n\nA TypeScript compiler for the monkey programming language, based on the excellent book [\"Writing An Compiler In Go\"](https://compilerbook.com/)\n\n## ⚙️ Installation\n\nTo get started, clone the repository:\n\n```bash\ngit clone https://github.com/bpetermann/ts-compiler.git\ncd ts-compiler\n```\n\nThen, install dependencies and build the project:\n\n```js\nnpm run build:fresh // Installs dependencies and builds the project\n```\n\n## 🚀 Start\n\nFinally, start the REPL (Read-Eval-Print Loop):\n\n```js\nnpm run start // Starts the REPL\n```\n\n## 📋 Usage Examples\n\n```js\n\u003e\u003e let a = 2; // Declare a variable\n\u003e\u003e let baz = [\"foo\", \"bar\"]; // Declare an array\n\u003e\u003e baz[0]; // Acesss array\n\u003e\u003e let person = {\"name\": \"Alice\"}; // Declare a hash map\n\u003e\u003e person[\"name\"]; // Access map\n```\n\nHere's a basic example illustrating the declaration and invocation of a function:\n\n```js\nlet fibonacci = fn(x) {\n  if (x == 0) {\n    0\n  } else {\n    if (x == 1) {\n      return 1;\n    } else {\n      fibonacci(x - 1) + fibonacci(x - 2);\n    }\n  }\n};\nfibonacci(5);\n```\n\nExample of closures:\n\n```js\nlet newClosure = fn(a) {\n  fn() { a; };\n  };\nlet closure = newClosure(99);\nclosure();\n```\n\nClose the REPL:\n\n```js\neof;\n```\n\n## Syntax Overview\n\nThe syntax embodies a rich spectrum of functionalities, managing mathematical expressions, variable assignments, function definitions, calls, conditionals, and returns. It adeptly handles concepts like higher-order functions and closures.\n\nAdditionally, the compiler accommodates diverse data types — integers, booleans, strings, arrays, and hashes.\n\nIt also features a set of built-in functions tailored to expedite string/array operations and console output logging.\n\n## 🧪 Tests\n\nThe following command will run all jest test suites:\n\n```js\nnpm run test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpetermann%2Fts-compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbpetermann%2Fts-compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpetermann%2Fts-compiler/lists"}