{"id":19347466,"url":"https://github.com/mrlsd/toy-codegen","last_synced_at":"2026-05-17T19:32:42.371Z","repository":{"id":206714844,"uuid":"717535021","full_name":"mrLSD/toy-codegen","owner":"mrLSD","description":"Toy Codegen as example for `semantic-analyzer-rs` library.","archived":false,"fork":false,"pushed_at":"2024-08-17T13:42:21.000Z","size":136,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-06T14:42:28.798Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/mrLSD.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-11-11T19:01:35.000Z","updated_at":"2024-08-17T13:42:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"9b76d9ab-0d32-4da7-810b-f2e32ec3c8d2","html_url":"https://github.com/mrLSD/toy-codegen","commit_stats":null,"previous_names":["mrlsd/toy-codegen"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrLSD%2Ftoy-codegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrLSD%2Ftoy-codegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrLSD%2Ftoy-codegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrLSD%2Ftoy-codegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrLSD","download_url":"https://codeload.github.com/mrLSD/toy-codegen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240457942,"owners_count":19804489,"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-10T04:16:34.827Z","updated_at":"2025-11-14T20:04:29.524Z","avatar_url":"https://github.com/mrLSD.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Toy Codegen\n\nToy Codegen is the example compiler for [semantic-analyzer-rs](https://github.com/mrLSD).\n\nAs Codegen backend used LLVM, with [inkwell](https://github.com/TheDan64/inkwell).\n\n## Basic design\n\nThere is a basic implementation of `code-generation`. The `Semantic AST` structure is \nused as a basic data source. This means that any subset of `programming languages` \ncan be represented, the main criterion for which is representability in a \nfinite AST structure of Semantic Analyzer, which is used in the `semantic-analyzer` \nlibrary.\n\n### Codegen implementation\n\nThe codege is focused only on those instructions that are presented as \nan AST sample. And it is not intended to cover all possible complex \ncases of code generation based on a complete set of `SemanticStateContext` \ninstructions. However, the end result is a fully functional binary code.\n\nThe basic parts is:\n- [x] Function declarations\n  - [x] Functions parameters initializations\n- [ ] Types declarations\n- [ ] Constants declarations\n- [x] Function body implementation\n  - [x] Let-binding\n    - [x] Codegen variables state\n  - [ ] Binding\n  - [x] Expressions\n    - [x] Codegen type conversions\n  - [ ] If conditions flow\n  - [ ] Loop conditions flow\n  - [ ] Function return flow\n- [x] Target triple initialization (LLVM backend)\n- [x] LLVM IR source code generation (and store to file)\n- [x] Binary code generation (and store to file)\n- [x] Code generation error flow with custom error types\n\n## LICENCE: MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrlsd%2Ftoy-codegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrlsd%2Ftoy-codegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrlsd%2Ftoy-codegen/lists"}