{"id":30355813,"url":"https://github.com/malcolmstill/qbe-zig-build","last_synced_at":"2025-08-19T05:15:13.026Z","repository":{"id":230938557,"uuid":"780512873","full_name":"malcolmstill/qbe-zig-build","owner":"malcolmstill","description":"QBE (https://c9x.me/compile/) via zig build","archived":false,"fork":false,"pushed_at":"2025-07-26T16:10:55.000Z","size":485,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-14T20:54:54.429Z","etag":null,"topics":["compiler-backend","qbe","zig","zig-package"],"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/malcolmstill.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}},"created_at":"2024-04-01T16:31:41.000Z","updated_at":"2025-07-26T16:14:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"f289349b-5461-4bcf-9c4b-c89141bec43c","html_url":"https://github.com/malcolmstill/qbe-zig-build","commit_stats":null,"previous_names":["malcolmstill/qbe-zig","malcolmstill/qbe-zig-build"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/malcolmstill/qbe-zig-build","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcolmstill%2Fqbe-zig-build","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcolmstill%2Fqbe-zig-build/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcolmstill%2Fqbe-zig-build/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcolmstill%2Fqbe-zig-build/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/malcolmstill","download_url":"https://codeload.github.com/malcolmstill/qbe-zig-build/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcolmstill%2Fqbe-zig-build/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271103202,"owners_count":24699646,"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","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["compiler-backend","qbe","zig","zig-package"],"created_at":"2025-08-19T05:15:10.833Z","updated_at":"2025-08-19T05:15:13.008Z","avatar_url":"https://github.com/malcolmstill.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QBE via zig\n\nThis repo provides QBE installable / dependable on via the zig package manager. QBE\ncan be invoked either as a binary or a library (with `qbe.emit`, see below).\n\nIf you're looking to generate the QBE intermediate language from zig code programmatically, check out\nhttps://github.com/ciathefed/qbe-zig.\n\n## QBE binary\n\nThe `qbe-zig` provides an artifact `qbe` that some other module can depend on:\n\n```zig\n// Depend on qbe-zig via a build.zig.zon\nconst qbe = b.dependency(\"qbe-zig\", .{ .target = target, .optimize = optimize });\n\n// Extract the `qbe` binary artifact\nconst qbe_bin = qbe.artifact(\"qbe\");\n```\n\n## QBE library\n\nThe upstream QBE repository does not expose a anyway of using QBE as a library.\n`qbe-zig` offers the ability to call QBE as library by more or less duplicating\nthe existing `main.c` as `lib.c` and replacing the `main` function with `libemit`.\n\nA tiny wrapper around `libemit` is then provided via `src/qbe.zig`.\n\nTo use QBE as a library in a zig project, in your `build.zig` have something like:\n\n```zig\n// Depend on qbe-zig via a build.zig.zon\nconst qbe = b.dependency(\"qbe-zig\", .{ .target = target, .optimize = optimize });\n\nconst exe = b.addExecutable(...);\n\n// Link against the static library\nexe.linkLibrary(qbe.artifact(\"qbe-lib\"));\n\n// Expose to your exe code\nexe.root_module.addImport(\"qbe-zig\", qbe.module(\"qbe-zig\"));\n```\n\nIn your zig code import the module:\n\n```zig\nconst qbe = @import(\"qbe-zig\");\n```\n\nCall `emit` where you need:\n\n```zig\nqbe.emit(\"test.ssa\", \"test.s\");\n```\n\nSee `example/` for full example of library usage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalcolmstill%2Fqbe-zig-build","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmalcolmstill%2Fqbe-zig-build","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalcolmstill%2Fqbe-zig-build/lists"}