Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wa-lang/ugo
µGo编程语言(从头开发一个迷你Go语言编译器)
https://github.com/wa-lang/ugo
aeeembly compiler go golang lexer llvm parser ugo wasm webassembly
Last synced: about 1 month ago
JSON representation
µGo编程语言(从头开发一个迷你Go语言编译器)
- Host: GitHub
- URL: https://github.com/wa-lang/ugo
- Owner: wa-lang
- Created: 2021-11-12T17:15:45.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-09-25T08:06:33.000Z (about 2 years ago)
- Last Synced: 2024-09-29T04:02:22.059Z (about 2 months ago)
- Topics: aeeembly, compiler, go, golang, lexer, llvm, parser, ugo, wasm, webassembly
- Language: Go
- Homepage: https://wa-lang.org/ugo-compiler-book
- Size: 230 KB
- Stars: 49
- Watchers: 4
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# µGo 编程语言
µGo 是 Go 语言的真子集(不含标准库部分), 可以直接作为Go代码编译执行.
- 安装 ugo: `go get github.com/wa-lang/ugo`.
- 实现原理: https://github.com/wa-lang/ugo-compiler-book## 例子
例子 ([_example/hello.ugo](_example/hello.ugo)):
```go
package mainfunc main() {
for n := 2; n <= 30; n = n + 1 {
var isPrime int = 1
for i := 2; i*i <= n; i = i + 1 {
if x := n % i; x == 0 {
isPrime = 0
}
}
if isPrime != 0 {
println(n)
}
}
}
```运行:
```
$ ugo run _examples/hello.ugo
2
3
5
7
11
13
17
19
23
29
```## 版权
个人学习目的可自由使用.