{"id":15704944,"url":"https://github.com/xrxr/alang","last_synced_at":"2025-05-12T17:58:13.736Z","repository":{"id":77651674,"uuid":"65517204","full_name":"XrXr/alang","owner":"XrXr","description":"A toy compiler for a statically typed language","archived":false,"fork":false,"pushed_at":"2019-01-21T00:15:17.000Z","size":353,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-14T06:31:47.665Z","etag":null,"topics":["compiler","programming-language","statically-typed"],"latest_commit_sha":null,"homepage":"","language":"Go","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/XrXr.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":"2016-08-12T02:35:56.000Z","updated_at":"2024-08-14T10:31:26.000Z","dependencies_parsed_at":"2023-02-27T14:30:25.435Z","dependency_job_id":null,"html_url":"https://github.com/XrXr/alang","commit_stats":{"total_commits":223,"total_committers":2,"mean_commits":111.5,"dds":0.008968609865470878,"last_synced_commit":"212f30adae8aa91aabffc2a2624e4f1ced8549bc"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XrXr%2Falang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XrXr%2Falang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XrXr%2Falang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XrXr%2Falang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XrXr","download_url":"https://codeload.github.com/XrXr/alang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231299746,"owners_count":18354983,"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","programming-language","statically-typed"],"created_at":"2024-10-03T20:14:21.091Z","updated_at":"2024-12-26T02:01:31.314Z","avatar_url":"https://github.com/XrXr.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## `alang`\n\n`alang` is a toy compiler written for a statically typed langugage similar to C in terms of features.\n`alang` only targets 64-bit X86-64 Linux and generates free standing binaries that don't depend on libc by default.\n\n## What does the lanaguage look like?\n\n[souvenir](https://github.com/XrXr/souvenir) excersises all of alang's features. Please take a look if you are interested.\n\n## Dependencies\n\n- `import \"github.com/davecgh/go-spew/spew\"` for printf debugging during development\n- `nasm` as a runtime dependency for assembling object files\n- `ld` for linking\n\n## Notes\n\n- Run `go test -tags integration` to run integration tests\n- Run `go generate parsing/*go` to get proper parse tree printing\n- Run `go generate ir/*go` to get proper ir printing\n\nHere is what the compiler does to generate a binary:\n  `parse into ast -\u003e frontend generates ir -\u003e type check/inference happens on ir -\u003e generate nasm asm -\u003e pass asm to nasm and run ld`\n\n- Instructions from ir operate on variables numbered from 0. Variables can be of any size\n- The first few variables are procedure arguments\n- While most irs have all the variables they use in the main struct body, there are some exceptions. See `frontend.Prune()`. The Extra field of ir.Inst comes in handy\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxrxr%2Falang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxrxr%2Falang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxrxr%2Falang/lists"}