{"id":13616375,"url":"https://github.com/wa-lang/ugo-compiler-book","last_synced_at":"2025-05-15T16:06:29.989Z","repository":{"id":39159559,"uuid":"424286527","full_name":"wa-lang/ugo-compiler-book","owner":"wa-lang","description":":books: µGo语言实现(从头开发一个迷你Go语言编译器)","archived":false,"fork":false,"pushed_at":"2024-09-26T00:49:56.000Z","size":8189,"stargazers_count":1510,"open_issues_count":6,"forks_count":127,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-04-11T21:12:56.122Z","etag":null,"topics":["wa","wa-lang","wasm","webassembly"],"latest_commit_sha":null,"homepage":"https://wa-lang.github.io/ugo-compiler-book","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wa-lang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-11-03T15:50:30.000Z","updated_at":"2025-04-11T09:20:26.000Z","dependencies_parsed_at":"2024-01-14T06:49:50.980Z","dependency_job_id":"5b2541e5-42b5-4660-b5d9-532c16b8e42b","html_url":"https://github.com/wa-lang/ugo-compiler-book","commit_stats":{"total_commits":234,"total_committers":8,"mean_commits":29.25,"dds":0.03418803418803418,"last_synced_commit":"ac20c480962bd67328fdad448915d9b003d1115a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wa-lang%2Fugo-compiler-book","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wa-lang%2Fugo-compiler-book/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wa-lang%2Fugo-compiler-book/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wa-lang%2Fugo-compiler-book/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wa-lang","download_url":"https://codeload.github.com/wa-lang/ugo-compiler-book/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248480430,"owners_count":21110937,"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":["wa","wa-lang","wasm","webassembly"],"created_at":"2024-08-01T20:01:27.657Z","updated_at":"2025-04-11T21:13:02.076Z","avatar_url":"https://github.com/wa-lang.png","language":"Go","funding_links":[],"categories":["Go","Repositories"],"sub_categories":[],"readme":"# 《µGo语言实现——从头开发一个迷你语言编译器》\n\n- *凹语言(专为 WebAssembly 设计): https://github.com/wa-lang/wa*\n- *WaBook(Go语言实现的MD电子书构建工具): https://github.com/wa-lang/wabook*\n\n----\n\n本书尝试以实现 µGo 编译器为线索，以边学习边完善的自举方式实现一个玩具语言。\n\n![](cover.svg)\n\n- 在线阅读(Go版本): https://wa-lang.github.io/ugo-compiler-book/\n- 示例代码(Go版本): [https://github.com/wa-lang/ugo](https://github.com/wa-lang/ugo) (和章节对应的分支)\n- µGo 输出C语言: https://github.com/3dgen/ugo-c-book\n- 社区分享: [Go编译器定制简介](https://wa-lang.org/ugo-compiler-book/go-compiler-intro.html)\n\n---\n\n## Why: 挖坑的起因\n\n- 因为坑就在那里\n- 挖坑的工具差不多齐全了\n- 为了启动 [凹语言](https://github.com/wa-lang/wa) 的热身项目\n- 凹语言项目已过5年, 完成了当初不做玩具车的目标, 是时候向凹语言迁移了\n- ？\n\n## What: µGo 例子\n\nµGo 最初是Go语言的子集, 也是凹语言项目的起点. 所以说µGo现在更像是凹语言的子集, 当然µGo是一个玩具语言.\n\n```go\nimport \"libc\"\nimport \"libc.math\" =\u003e m\n\nconst Pi = 3.14\nconst Pi_2 = Pi * 2\n\ntype MyInt :int\n\nglobal x = println(1 + 2*(3+4) + -10 + double(50))\n\nfunc println() =\u003e int\n\nfunc main =\u003e int {}\n```\n\n## Output: 输出的目标格式\n\n为了跨平台和方便测试，输出LLVM汇编代码，如果以后可能会增加WASM文件。\n\n## License 版权\n\n学习目的可免费阅读。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwa-lang%2Fugo-compiler-book","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwa-lang%2Fugo-compiler-book","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwa-lang%2Fugo-compiler-book/lists"}