{"id":20633561,"url":"https://github.com/davidelettieri/kaleidoscope","last_synced_at":"2025-04-15T19:19:27.861Z","repository":{"id":53725988,"uuid":"314833188","full_name":"davidelettieri/Kaleidoscope","owner":"davidelettieri","description":"a c# version of the kaleidoscope tutorial","archived":false,"fork":false,"pushed_at":"2025-02-20T07:35:49.000Z","size":166,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-15T19:19:05.486Z","etag":null,"topics":["csharp","kaleidoscope","llvm"],"latest_commit_sha":null,"homepage":"","language":"C#","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/davidelettieri.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":"2020-11-21T14:43:59.000Z","updated_at":"2025-04-12T20:28:50.000Z","dependencies_parsed_at":"2023-12-17T10:26:10.547Z","dependency_job_id":"b089b458-f952-45ca-87e5-5488622db266","html_url":"https://github.com/davidelettieri/Kaleidoscope","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidelettieri%2FKaleidoscope","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidelettieri%2FKaleidoscope/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidelettieri%2FKaleidoscope/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidelettieri%2FKaleidoscope/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidelettieri","download_url":"https://codeload.github.com/davidelettieri/Kaleidoscope/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249135834,"owners_count":21218365,"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":["csharp","kaleidoscope","llvm"],"created_at":"2024-11-16T14:21:05.185Z","updated_at":"2025-04-15T19:19:27.838Z","avatar_url":"https://github.com/davidelettieri.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kaleidoscope\n\nThe Kaleidoscope tutorial implemented with C# and [LLVMSharp](https://github.com/microsoft/LLVMSharp).\n\nMy implementation does not follow the official Kaleidoscope tutorial written in C++, other C# implementations can be found at [LLVMSharp](https://github.com/microsoft/LLVMSharp) and in [here](https://ice1000.org/llvm-cs/en/). \n\nSome useful resources are:\n* [Stephen Diehl haskell implementation](https://www.stephendiehl.com/llvm/)\n* [Crafting interpreters](https://www.craftinginterpreters.com/)\n\nThe aim of the project was to try to use LLVMSharp and to have something running wih LLVM. The behavior of the demo is not the same as the official tutorial (which I did not run) nor as the C# examples in LLVMSharp, which I was not able to make it run correctly.\n\nAs of today the project should support almost everything up to Chapter 7 of the official Kaleidscope tutorial. Feel free to drop me a line or to open an issue. Be kind it's a work in progress :)\n\n## Some differences with the official Kaleidoscope tutorial\n\n* Functions definitions requires a comma ',' between arguments.\n* I defined a `putchard` function which uses `Console.Writeline`.\n* I used the visitor pattern in the interpreter/emitter\n* I defined more AST types\n\n## Chapters\n\nI split the implementation of Chapter 6 and Chapter 7. Chapter 7 introduces mutable variables and remove the need for the `phi` nodes in the `for` expression so I kept Chapter 6 as a reference. Both chapters can run the mandelbrot example, Chapter 7 has an additional `demo` file to run the iterative fibonacci e to compute the sum of the first 10 natural numbers.\n\n### Notes\n\nIf you're playing with LLVM like I did, I found very useful to look at the IR generated by a simple `C` program. Use the command `clang -S -emit-llvm foo.c` on your test file to view the emitted IR, for example you can see the emitted code for a simple for loop. Another useful trick is to look at your generated IR with the optimization passes and without the optimization passes.\n\n## Run the mandelbrot set implementation\n\nLook for the mandelbrot file included in the sources and from the folder Kaleidoscope.Chapter6 or Kaleidoscope.Chapter7 run `dotnet run mandelbrot`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidelettieri%2Fkaleidoscope","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidelettieri%2Fkaleidoscope","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidelettieri%2Fkaleidoscope/lists"}