{"id":18918858,"url":"https://github.com/alexw00/tinycompts","last_synced_at":"2025-04-15T10:33:12.350Z","repository":{"id":45115288,"uuid":"436253506","full_name":"AlexW00/TinyCompTS","owner":"AlexW00","description":"🤖 A tiny JS/TS compiler written in vanilla TS.","archived":false,"fork":false,"pushed_at":"2022-05-07T08:01:16.000Z","size":89,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-06T12:07:34.857Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/AlexW00.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}},"created_at":"2021-12-08T13:15:44.000Z","updated_at":"2025-03-10T08:36:55.000Z","dependencies_parsed_at":"2022-09-14T07:30:52.386Z","dependency_job_id":null,"html_url":"https://github.com/AlexW00/TinyCompTS","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexW00%2FTinyCompTS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexW00%2FTinyCompTS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexW00%2FTinyCompTS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexW00%2FTinyCompTS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexW00","download_url":"https://codeload.github.com/AlexW00/TinyCompTS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249051899,"owners_count":21204914,"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":[],"created_at":"2024-11-08T10:34:03.713Z","updated_at":"2025-04-15T10:33:12.054Z","avatar_url":"https://github.com/AlexW00.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n\u003cdiv align=\"center\"\u003e \n\u003ch1\u003e🤖 TinyCompTS\u003c/h1\u003e\n\nA tiny (~ 26kb) Javascript/Typescript compiler written in vanilla Typescript as a hobby project.\n\u003c/div\u003e\n\n## 🦾 Capabilities\n\n- **Tokens**: [Maximum Munch](https://en.wikipedia.org/wiki/Maximal_munch), RegEx matching\n- **Syntax**: \n  - [Recursive descent parser](https://en.wikipedia.org/wiki/Recursive_descent_parser)\n    - → linear time complexity\n    - → support for [LL-Type Context Free Grammars](https://en.wikipedia.org/wiki/LL_grammar)\n  - Quantifier support (→ see example [SyntaxRuleset](/ts/attributeGrammar/syntaxRuleset.ts)):\n    - `?` = zero or one\n    - `*` = zero or more\n    - `+` = one or more\n- **Semantics**: Bottom-up, demand driven evaluation\n  - → support for arbitrary, non-recursive [Attribute Grammars](https://en.wikipedia.org/wiki/Attribute_grammar)\n\n## 📖 Guide\n\n### 1. Define an **attribute grammar**\n\nCreate an object that implements [AttributeGrammar](/ts/attributeGrammar/attributeGrammar.ts):\n\n1. Define a lexical ruleset by creating an object that implements [LexicalRuleset](/ts/attributeGrammar/lexicalRuleset.ts)\n2. Define a syntax ruleset by creating an object that implements [SyntaxRuleset](/ts/attributeGrammar/syntaxRuleset.ts)\n3. Define a semantic ruleset by creating an object that implements [SemanticRuleset](/ts/attributeGrammar/semanticRuleset.ts)\n\n### 2. Configure TinyComp\n\n1. Create an object that implements [TinyCompOptions](/ts/TinyComp.ts)\n2. Create an instance of [TinyComp](/ts/TinyComp.ts) using the AttributeGrammar and TinyCompOptions object\n3. Use `compiler.compile(input: string)` to compile input\n\n## 📔 Example \n\n→ see [example.ts](/example.ts)\n\n## Import\n\n### 🦖 Denoland\n\n```\nimport TinyComp, {...} from \"https://deno.land/x/tiny_comp_ts/ts/TinyComp.ts\";\n```\n\n### ❤️ Npm\n\n```\nnpm i tiny-comp\n\nimport TinyComp, {...} from \"tiny-comp\";\n```\n\n### 🧪 Just test\n\n1. Install the JS/TS runtime [Deno](https://deno.land/)\n2. Clone this repo \u0026 navigate into the root directory\n3. ```deno run ./example.ts```\n\nAlternatively, run via docker\n\n1. Clone this repo \u0026 navigate into the root directory\n2. ```docker run -it -v $PWD:/app denoland/deno:1.17.1 run --allow-net /app/example.ts```\n\n## 👨‍💻 Development\n\n### Contributing\n\nFeel free to make a pull request if you like. Keep it minimal and efficient.\n\n### Codebase diagram:\n\n![Visualization of the codebase](./diagram.svg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexw00%2Ftinycompts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexw00%2Ftinycompts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexw00%2Ftinycompts/lists"}