Go port of LLVM's Kaleidoscope Tutorial using the tinygo llvm bindings. doc
# Ubuntu 20.04 Golang 16.0+
LLVM_SOURCE="deb https://mirrors.tuna.tsinghua.edu.cn/llvm-apt/focal/ llvm-toolchain-focal-14 main"
sudo echo "$LLVM_SOURCE" > /etc/apt/sources.list.d/llvm.list
sudo apt update
sudo apt install llvm-14-dev
go build -ldflags "-s -w"
./toy fib.k && ./fib
-
Rob Pike's Lexical Scanning in Go — our lexer is based on the design outlined in this talk.