ugo-compiler-book icon indicating copy to clipboard operation
ugo-compiler-book copied to clipboard

:books: µGo语言实现(从头开发一个迷你Go语言编译器)

《µGo语言实现——从头开发一个迷你Go语言编译器》

  • KusonStack一站式可编程配置技术栈(Go): https://github.com/KusionStack/kusion
  • KCL 配置编程语言(Rust): https://github.com/KusionStack/KCLVM
  • 凹语言™: https://github.com/wa-lang/wa

本书尝试以实现 µGo 编译器为线索,以边学习边完善的自举方式实现一个玩具语言。


What: µGo 例子

package main

import "libc"
import m "libc.math"

const Pi = 3.14
const Pi_2 = Pi * 2

type MyInt int
type MyInt2 = int

var x = println(1 + 2*(3+4) + -10 + double(50))

func println() int

func main() int {}

Output: 输出的目标格式

为了跨平台和方便测试,输出LLVM汇编代码,如果以后可能会增加WASM文件。

License 版权

学习目的可在 Github 平台免费阅读。