{"id":38277953,"url":"https://github.com/schurhammer/gig","last_synced_at":"2026-01-17T01:54:51.392Z","repository":{"id":244481089,"uuid":"793291586","full_name":"schurhammer/gig","owner":"schurhammer","description":"A Gleam compiler written in Gleam","archived":false,"fork":false,"pushed_at":"2025-09-23T21:51:39.000Z","size":1503,"stargazers_count":114,"open_issues_count":3,"forks_count":0,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-10-11T05:55:54.736Z","etag":null,"topics":["c","compiler","gleam","native","pld","pldi","third-party"],"latest_commit_sha":null,"homepage":"","language":"Gleam","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/schurhammer.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-04-28T23:38:00.000Z","updated_at":"2025-10-06T06:30:55.000Z","dependencies_parsed_at":"2024-09-13T23:31:20.849Z","dependency_job_id":"840a5913-71f0-4c7b-928a-3f33b86ae472","html_url":"https://github.com/schurhammer/gig","commit_stats":null,"previous_names":["schurhammer/gig"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/schurhammer/gig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schurhammer%2Fgig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schurhammer%2Fgig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schurhammer%2Fgig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schurhammer%2Fgig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schurhammer","download_url":"https://codeload.github.com/schurhammer/gig/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schurhammer%2Fgig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28491793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T00:50:05.742Z","status":"ssl_error","status_checked_at":"2026-01-17T00:43:11.982Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["c","compiler","gleam","native","pld","pldi","third-party"],"created_at":"2026-01-17T01:54:51.327Z","updated_at":"2026-01-17T01:54:51.380Z","avatar_url":"https://github.com/schurhammer.png","language":"Gleam","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gig\n\nGig is a gleam compiler written in gleam.\n\n## How to use\n\n### Compile and run a sample file:\n\n```bash\n# clone the repository\ngit clone https://github.com/schurhammer/gig\ncd gig\n\n# compile a sample\ngleam run samples/hello_world.gleam\n\n# run the sample\nsamples/hello_world.exe\n```\n\n- This will compile the file `samples/hello_world.gleam` to `samples/hello_world.c` and then use a c compiler to create the binary at `samples/hello_world.exe`.\n- Gig adds the `.exe` extension to avoid common naming conflicts with source directories.\n\n### Compile gig:\n\n```bash\n# compile gig into a binary\ngleam run src/gig.gleam --gc --release\n\n# compile a sample using the gig binary\nsrc/gig.exe samples/hello_world.gleam\n\n# run the sample\nsamples/hello_world.exe\n```\n\n### Compile your project using the gig binary:\n\n- Add the `gig` executable to your path or copy it into your project.\n- Copy the `patch` directory into your project.\n\n```bash\n# you should be in your project root\ncd \u003cyour project root\u003e\n\n# copy patch directory (adjust file paths to match your system)\ncp -r ../gig/patch patch\n\n# ensure dependencies are downloaded\ngleam deps download\n\n# compile your main module\ngig src/\u003cmain module\u003e.gleam\n\n# run your main module\nsrc/\u003cmain module\u003e.exe\n```\n\n- You should run gig from the root directory of the project.\n- Gig will include source files from the main module's directory, the `patch` directory, and each source directory of downloaded dependencies (i.e. `build/packages/\u003cpackage_name\u003e/src`).\n- Download dependencies using `gleam deps download`.\n- Your main module should be non-nested i.e. directly in the `src` directory.\n\n### Compile your project using gig as a path dependency\n\n- Add gig as a path dependency in your `gleam.toml` file `gig = { path = \"../gig\" }`.\n- Copy the `patch` directory into your project.\n\n```bash\n# you should be in your project root\ncd \u003cyour project root\u003e\n\n# copy patch directory (adjust file paths to match your system)\ncp -r ../gig/patch patch\n\n# ensure dependencies are downloaded\ngleam deps download\n\n# compile your project using gig as a path dependency\ngleam run -m gig src/\u003cmain module\u003e.gleam\n\n# run your main module\nsrc/\u003cmain module\u003e.exe\n```\n\n### Optional flags:\n\n- `--release`: enable optimisation.\n- `--gc`: enable garbage collection (otherwise no garbage collection).\n- `--debug`: include debug symbols.\n- `--headers`: generate header files for FFI functions.\n- `--compiler=name`: the name/path of the c compiler.\n- `-c`: only generate the c file (not the binary).\n\n\u003e [!IMPORTANT]\n\u003e In the likely case you encounter stack overflows, increase your stack size. These often show up as segfaults.\n\u003e\n\u003e ```\n\u003e ulimit -s unlimited\n\u003e ```\n\n## Required Dependencies:\n\n- C compiler (clang seems to work best)\n- Boehm GC is needed for `--gc` (aka `libgc`)\n\n## Standard Library\n\nSince much of the standard library is implemented with `@external` calls, not all functions are available at this time.\nSome functions have already been re-implemented with patches, see the `patch` directory. The compiler will print a warning if an unimplemented function is used, and a \"todo\" will be used as the function body.\n\n## Patch System\n\nSince gig is a third party project, most gleam libraries in the wild are\nunlikely to support it. For these situations we have a patch system that\nlets you override some modules that would otherwise not work. To do this simply\ncreate a module called `x.patch.gleam` where `x` is the name of the module\nyou wish to patch. The patch will be merged with the original module, so you\nonly need to implement the functions that are broken.\nPatches can be placed in the `patch` directory or any of the source directories.\n\nFor better c language support in your editor, you can add a `.clangd` and\n`compile_flags.txt` file to your project.\n\n`.clangd`:\n\n```\nCompileFlags:\n  Add: [-Ipatch]\n```\n\n`compile_flags.txt`: (empty file)\n\n## FFI\n\nYou can use the `@external(c, \"\", \"function_name\")` annotation to define C\nfunctions, similar to FFI in normal gleam.\nAfter this, run the compiler with the `--headers` option to generate a header file\nwith function and type declarations required to implement the external function.\nYour implementation C file should `#include` the header file and be named in the\nsame way as the header file.\nPreferably your functions should be namespaced e.g. `module_name_function_name()`.\n\n## Feature / Todo List\n\n### Basics\n\n- [x] Bool\n- [x] Int\n- [x] Float\n- [x] Number formats (other than decimal)\n- [x] String\n- [x] List\n- [x] Equality\n- [x] Assignments\n- [x] Discard patterns\n- [x] Type inference\n- [x] Type annotations\n- [x] Modules (note: modules are resolved relative to the target file)\n- [x] Dependencies\n- [x] Unqualified imports\n- [x] Type aliases\n- [x] Blocks\n- [x] Constants\n- [x] Memory Management (GC/RC)\n\n### Functions\n\n- [x] Functions\n- [x] Higher order functions\n- [x] Anonymous functions\n- [x] Function captures\n- [x] Generic functions\n- [x] Pipelines\n- [x] Labeled arguments\n- [ ] Documentation comments (ignored)\n- [ ] Deprecations (ignored)\n\n### Flow control\n\n- [x] Case expressions\n- [x] Variable patterns\n- [x] Constructor patterns\n- [x] String patterns\n- [x] List patterns\n- [x] Recursion\n- [ ] Tail calls (note: the c compiler may do this for us)\n- [x] Multiple subjects\n- [x] Alternative patterns\n- [x] Pattern aliases\n- [x] Guards\n- [ ] Exhaustiveness checking\n\n### Other Data types\n\n- [x] Tuples\n- [x] Custom Types\n- [x] Records\n- [x] Record accessors\n- [x] Record updates\n- [x] Generic custom types\n- [x] Results\n- [ ] Bit arrays (partial support)\n\n### Advanced features\n\n- [ ] Opaque types\n- [x] Use\n- [x] Todo\n- [x] Panic\n- [x] Let assert\n- [x] Externals\n\n## Contributing\n\nI am not accepting code contributions at this time. Feel free to make issues, suggestions, or discussions though.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschurhammer%2Fgig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschurhammer%2Fgig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschurhammer%2Fgig/lists"}