本书尝试以实现 µGo 编译器为线索,以边学习边完善的自举方式实现一个玩具语言。
- µGo 简介 - ugo 子目录是正在实现中的代码
- 在线阅读: https://chai2010.cn/ugo-compiler-book/
- µGo 输出C语言: https://github.com/3dgen/ugo-c-book
- 因为坑就在那里
- 不希望被Rxxx语言把脸摁在地上摩擦
- 凹坑的工具差不多齐全了
- ?
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 {}
为了跨平台和方便测试,输出LLVM汇编代码,如果以后可能会增加WASM文件。
学习目的可自由使用。