The XGo Programming Language xgo.dev | Docs | XGo vs. Go | Tutorials | Playground | XGo REPL (iXGo) | Contributing & compiler design <!-- --> XGo is a programming…
The XGo Programming Language
xgo.dev | [Docs](doc/docs.md) | [XGo vs. Go](doc/xgo-vs-go.md) | Tutorials | Playground | XGo REPL (iXGo) | [Contributing & compiler design](doc/contributing.md)
<!--



-->





XGo is a programming language that reads like plain English. But it's also incredibly powerful — it lets you leverage assets from C/C++, Go, Python, and JavaScript/TypeScript, creating a unified software engineering ecosystem.
XGo := C * Go * Python * JavaScript + Scratch
Our vision is to enable everyone to become a builder of the world.
Easy to learn
- Simple and easy to understand
- Smaller syntax set than Go and Python in best practices
Ready for large projects
- Integrate C/C++, Go, Python, and JavaScript/TypeScript into a unified ecosystem
- Derived from Go and easy to build large projects from its good engineering foundation
- For engineering: working in the simplest language that can be mastered by children.
- For STEM education: studying an engineering language that can be used for work in the future.
- For data science: communicating with engineers in the same language.
Key Features of XGo
- Approaching natural language expression and intuitive (see [How XGo simplifies Go's expressions](#how-xgo-simplifies-gos-expressions)).
- Smallest but Turing-complete syntax set in best practices (see [The XGo Mini Specification](doc/spec-mini.md)).
- Fully compatible with Go and can mix Go/XGo code in the same package (see [The XGo Full Specification](doc/spec.md) and [Go/XGo Hybrid Programming](doc/docs.md#gogo-hybrid-programming)).
- Integrating with the C ecosystem including Python/JavaScript and providing limitless possibilities based on LLGo (see [Importing C/C++ and Python libraries](#importing-cc-and-python-libraries)).
- Does not support DSL (Domain-Specific Languages), but supports SDF (Specific Domain Friendliness) (see [XGo Classfiles](#xgo-classfiles) and [Domain Text Literals](doc/domian-text-lit.md)).
How XGo simplifies Go's expressions
Different from the function call style of most languages, XGo recommends command style code:
coffee
println "Hello world"
To emphasize our preference for command style, we introduce echo as an alias for println:
coffee
echo "Hello world"
For more discussion on coding style, see https://tutorial.xgo.dev/hello-world.
Code style is just the first step. We have made many efforts to make the code more intuitive and closer to natural language expression. These include:
| Go code | XGo code | Note |
| ---- | ---- | ---- |
| package mainimport "fmt"func main() { fmt.Println("Hi")} | import "fmt"fmt.Println("Hi") | Program structure: XGo allows omitting package main and func main |
| fmt.Println("Hi") | echo("Hi") | [More builtin functions](doc/builtin.md): It simplifies the expression of the most common tasks |
| fmt.Println("Hi") | echo "Hi" | [Command-line](doc/fncall.md) style code: It reduces the number of parentheses in the code as much as possible, making it closer to natural language |
| name := "Ken"fmt.Printf( "Hi %s\n", name) | name := "Ken"echo "Hi ${name}" | [Goodbye printf](doc/goodbye-printf.md), use ${expr} in [string](doc/string.md) literals |
| a := []int{1, 2, 3} | a := [1, 2, 3] | [List/Slice](doc/slice.md) literals |
| a = append(a, 4)a = append(a, 5, 6, 7) | a <- 4a <- 5, 6, 7 | Append values to a list |
| a := map[string]int{ "Monday": 1, "Tuesday": 2,} | a := { "Monday": 1, "Tuesday": 2,} | [Map](doc/map.md) literals |
| OnStart(func() { ...}) | onStart => { ...} | [Lambda](doc/func-closure.md) expressions |
| Play("1.mp3", &Options{Loop: true}) | play "1.mp3", loop = true | Python-like [keyword arguments](doc/func-closure.md#keyword-arguments) (kwargs) |
| type Rect struct { Width float64 Height float64} | type Rect (width, height float64) | [Tuples vs. Structs](doc/struct-vs-tuple.md): We encourage using tuples to implement UDTs instead of structs. |
| type Rect struct { Width float64 Height float64}func (this *Rect) Area() float64 { return this.Width * this.Height} | var ( Width float64 Height float64)func Area() float64 { return Width * Height} | [XGo Classfiles](doc/classfile.md): We can express OOP with global variables and functions. |
For more details, see [The XGo Mini Specification](doc/spec-mini.md).
Importing C/C++ and Python libraries
XGo can choose different Go compilers as its underlying support. Currently known supported Go compilers include:
- go (The official Go compiler supported by Google)
- llgo (The Go compiler supported by the XGo team)
- tinygo (A Go compiler for small places)
LLGo is a Go compiler based on LLVM in order to better integrate Go with the C ecosystem including Python and JavaScript. It aims to expand the boundaries of Go/XGo, providing limitless possibilities such as:
- Game development
- AI and data science
- WebAssembly
- Embedded development
- ...
-llgo flag when initializing an XGo module:
sh
xgo mod init -llgo YourModulePath
This will generate a go.mod file with the following contents (It may vary slightly depending on the versions of local XGo and LLGo):
go
module YourModulePath
go 1.21 // llgo 1.0
require github.com/goplus/lib v0.2.0
Based on LLGo, XGo can import libraries written in C/C++ and Python.
Here is an example (see [chello](demo/_llgo/chello/hello.xgo)) of printing Hello world using C's printf:
go
import "c"
c.printf c"Hello world\n"
Here, c"Hello world\n" is a syntax supported by XGo, representing a null-terminated C-style string.
To run this example, you can:
sh
cd YourModulePath # set work directory to your module
xgo mod tidy # for generating go.sum file
xgo run .
And here is an example (see [pyhello](demo/_llgo/pyhello/hello.xgo)) of printing Hello world using Python's print:
go
import "py/std"
std.print py"Hello world"
Here, py"Hello world" is a syntax supported by XGo, representing a Python string.
Here are more examples of XGo calling C/C++ and Python libraries:
- [pytensor](demo/_llgo/pytensor/tensor.xgo): a simple demo using py/torch
- [tetris](demo/_llgo/tetris/tetris.xgo): a tetris game based on c/raylib
- [sqlitedemo](demo/_llgo/sqlitedemo/sqlitedemo.xgo): a demo using c/sqlite
XGo Classfiles
One language can change the whole world.
XGo is a "DSL" for all domains.
Rob Pike once said that if he could only introduce one feature to Go, he would choose interface instead of goroutine. classfile (and class framework) is as important to XGo as interface is to Go.
In the design philosophy of XGo, we do not recommend DSL (Domain Specific Language). But SDF (Specific Domain Friendliness) is very important. The XGo philosophy about SDF is:
Don't define a language for specific domain.
Abstract domain knowledge for it.
XGo introduces classfile and class framework to abstract domain knowledge.
- [What's Classfile?](doc/classfile.md#whats-classfile)
- [Dive into XGo Classfiles](doc/classfile.md)
- STEM Education: spx: A Scratch Compatible 2D Game Engine
- AI Programming: mcp: An XGo implementation of the Model Context Protocol (MCP)
- AI Programming: mcptest: An XGo MCP Test Framework
- Web Programming: yap: Yet Another HTTP Web Framework
- Web Programming: yaptest: An XGo HTTP Test Framework
- Web Programming: ydb: An XGo Database Framework
- CLI Programming: cobra: A Commander for modern XGo CLI interactions
- CLI Programming: gsh: An alternative to write shell scripts
- Unit Test: [test: Unit Test](doc/classfile.md#class-framework-unit-test)
yap: Yet Another HTTP Web Framework
This classfile has the file suffix .yap.
Create a file named get.yap with the following content:
go
html `Hello, YAP!`
Execute the following commands:
sh
xgo mod init hello
xgo get github.com/goplus/yap@latest
xgo mod tidy
xgo run .
A simplest web program is running now. At this time, if you visit http://localhost:8080, you will get:
Hello, YAP!
YAP uses filenames to define routes. get.yap's route is get "/" (GET homepage), and get_p_#id.yap's route is get "/p/:id" (In fact, the filename can also be get_p_:id.yap, but it is not recommended because : is not allowed to exist in filenames under Windows).
Let's create a file named get_p_#id.yap with the following content:
coffee
json {
"id": ${id},
}
Execute xgo run . and visit http://localhost:8080/p/123, you will get:
{"id": "123"}
See yap: Yet Another HTTP Web Framework for more details.
spx: A Scratch Compatible 2D Game Engine
Through this example you can learn how to implement dialogues between multiple actors.
Here are some codes in Kai.spx:
coffee
onStart => {
say "Where do you come from?", 2
broadcast "1"
}
onMsg "2", => {
say "What's the climate like in your country?", 3
broadcast "3"
}
We call onStart and onMsg to listen events. onStart is called when the program is started. And onMsg is called when someone calls broadcast to broadcast a message.
When the program starts, Kai says Where do you come from?, and then broadcasts the message 1. Who will receive this message? Let's see codes in Jaime.spx:
coffee
onMsg "1", => {
say "I come from England.", 2
broadcast "2"
}
Yes, Jaime receives the message 1 and says I come from England.. Then he broadcasts the message 2. Kai receives it and says What's the climate like in your country?.
The following procedures are very similar. In this way you can implement dialogues between multiple actors.
See spx: A Scratch Compatible 2D Game Engine for more details.
gsh: XGo DevOps Tools
Yes, now you can write shell script in XGo. It supports all shell commands.
Let's create a file named example.gsh and write the following code:
coffee
mkdir "testgsh"
Don't need a go.mod file, just enter xgo run ./example.gsh directly to run.
See gsh: XGo DevOps Tools for more details.
How to install
Note: Requires go1.19 or later
on Windows
sh
winget install goplus.xgo
on Debian/Ubuntu
sh
sudo bash -c ' echo "deb [trusted=yes] https://pkgs.xgo.dev/apt/ /" > /etc/apt/sources.list.d/goplus.list'
sudo apt update
sudo apt install xgo
on RedHat/CentOS/Fedora
sh
sudo bash -c 'echo -e "[goplus]\nname=XGo Repo\nbaseurl=https://pkgs.xgo.dev/yum/\nenabled=1\ngpgcheck=0" > /etc/yum.repos.d/goplus.repo'
sudo yum install xgo
on macOS/Linux (Homebrew)
Install via brew
sh
$ brew install xgo
from source code
bash
git clone https://github.com/goplus/xgo.git
cd xgo
# On mac/linux run:
./all.bash
# On Windows run:
all.bat
XGo Applications
Game Programming
Web Programming
DevOps Tools
Data Processing
IDE Plugins
- vscode: Go/XGo for Visual Studio Code
Contributing
The XGo project welcomes all contributors. We appreciate your help!
For more details, see [Contributing & compiler design](doc/contributing.md).
Give a Star! ⭐
If you like or are using XGo to learn or start your projects, please give it a star. Thanks!
Members
-
xgo ★ PINNED
XGo is a programming language that reads like plain English. But it's also incredibly powerful — it lets you leverage assets from C/C++, Go, Python, and JavaScript/TypeScript, creating a unified software engineering ecosystem. Our vision is to enable everyone to become a builder of the world.
Go ★ 9.4k 5h agoExplain → -
ixgo ★ PINNED
The Go/XGo Interpreter
Go ★ 140 13d agoExplain → -
builder ★ PINNED
XBuilder
TypeScript ★ 67 3d agoExplain → -
spx ★ PINNED
spx - A Scratch Compatible Go/XGo 2D Game Engine for STEM education
Go ★ 122 3d agoExplain → -
xai ★ PINNED
No description.
Go ★ 8 2mo agoExplain → -
gogen ★ PINNED
Code generator for the Go language
Go ★ 170 2d agoExplain → -
py
Golang bindings to the CPython C-API
Go ★ 324 2y agoExplain → -
c2go ▣
Convert C to Go
Go ★ 299 2y agoExplain → -
bpl
Binary Processing Language
Go ★ 152 2mo agoExplain → -
mcp
A XGo implementation of the Model Context Protocol (MCP), enabling seamless integration between LLM applications and external data sources and tools.
Go ★ 50 26d agoExplain → -
tutorial
Tutorials for XGo (The XGo Language)
Go ★ 44 2d agoExplain → -
hdq ▣
HTML DOM Query Language for XGo
Go ★ 42 4mo agoExplain → -
reflectx
Golang reflect package hack tools
Assembly ★ 33 6d agoExplain → -
yap
Yet Another Go/XGo HTTP Web Framework
Go ★ 29 1d agoExplain → -
www
Source code of https://xgo.dev
Go ★ 29 2mo agoExplain → -
yaigop ▣
Yet Another Go+ interpreter (still in beta version)
Go ★ 28 1mo agoExplain → -
libc ▣
Porting libc from C to Go
Go ★ 24 2y agoExplain → -
pyg ▣
Python to Go tools
Go ★ 12 2y agoExplain → -
mod
Module support for Go/XGo
Go ★ 10 6h agoExplain → -
vscode-xgo ⑂
Go/XGo extension for Visual Studio Code
TypeScript ★ 10 4mo agoExplain → -
community
Go+ Community written in Go+
JavaScript ★ 10 1y agoExplain → -
xgolsw
XGo Language Server that runs in the browser using WebAssembly
Go ★ 8 5d agoExplain → -
sqlite-c2go ▣
sqlite for Go+
Go ★ 7 2y agoExplain → -
igo ▣
Yet another interpreter for the Go language
Go ★ 7 4y agoExplain → -
xagent
No description.
Go ★ 6 3mo agoExplain → -
tools ⑂
XGo Tools & XGo Language Server
Go ★ 6 4mo agoExplain → -
llpyg
LLGo autogen tool for Python packages
Go ★ 6 8mo agoExplain → -
spx-editor ▣
Spx editor
JavaScript ★ 6 4y agoExplain → -
xgols
The Go/XGo Language Server
Go ★ 5 4mo agoExplain → -
canvas-2d ▣
HTML Canvas 2D Context API for mobile, desktop and web
Go ★ 5 4y agoExplain → -
vscode-goplus ⑂ ▣
GoPlus (Go+) Plugin for vscode
TypeScript ★ 5 2y agoExplain → -
lib
LLGo Standard Libraries
Go ★ 4 7mo agoExplain → -
AircraftWar
AircraftWar - a game powered by Go+ Builder
Shell ★ 4 1y agoExplain → -
FlappyCalf
FlappyCalf - a game powered by Go+ Builder
Shell ★ 4 7mo agoExplain → -
llgoexamples
LLGo Examples
C ★ 4 1y agoExplain → -
godot ⑂
Godot Engine – Multi-platform 2D and 3D game engine
C++ ★ 3 4d agoExplain → -
emb
LLGo Embedded Libraries
Go ★ 3 6mo agoExplain → -
classfile-project-template
A template for starting a new classfile project
★ 3 2y agoExplain → -
cppkg
C/C++ Package Center
Python ★ 3 1y agoExplain → -
sqlite ▣
LLGo wrapper of sqlite
Go ★ 3 2y agoExplain → -
cpython ▣
Linking Python to Go (powered by LLGo)
Go ★ 3 2y agoExplain → -
dql
DOM Query Language
Go ★ 2 6h agoExplain → -
OrcaSlicer ⑂
G-code generator for 3D printers (Bambu, Prusa, Voron, VzBot, RatRig, Creality, etc.)
C++ ★ 2 1mo agoExplain → -
ipkg
No description.
Go ★ 2 2mo agoExplain → -
typescript ⑂
Staging repo for development of native port of TypeScript
Go ★ 2 3mo agoExplain → -
setup-goplus ▣
Set up your GitHub Actions workflow with a specific version of Go+
TypeScript ★ 2 2y agoExplain → -
mathf ▣
Mathematical Utilities for Go (deprecated)
Go ★ 2 10mo agoExplain → -
expect
Expect for Go+
Go ★ 2 4y agoExplain → -
xgodlv
xgodlv is a debugger for the Go/XGo programming language
Go ★ 2 7mo agoExplain → -
huh
Build terminal forms and prompts 🤷🏻♀️
Go ★ 2 1y agoExplain → -
uws
HTTP based on uWebSockets
C++ ★ 2 1y agoExplain → -
winget-pkgs ⑂
The Microsoft community Windows Package Manager manifest repository
★ 2 13d agoExplain → -
gopmodifytags ⑂
Go+ tool to modify struct field tags
Go ★ 2 2y agoExplain → -
installer
Go+ Installer for Windows, MacOS, etc.
Go ★ 2 4y agoExplain → -
gopyter ⑂
A jupyter kernel for GoPlus
★ 2 5y agoExplain → -
cobra ⑂
A Commander for modern Go/XGo CLI interactions with zero third-party dependencies
Go ★ 1 1mo agoExplain → -
js
No description.
Go ★ 1 2mo agoExplain → -
newlib
A fork of newlib-esp32
C ★ 1 3mo agoExplain → -
xclaw
XClaw
★ 1 3mo agoExplain → -
gitrans
Git Transform
Go ★ 1 4mo agoExplain → -
genai
No description.
★ 1 4mo agoExplain → -
setup-xgo
Set up your GitHub Actions workflow with a specific version of XGo
TypeScript ★ 1 4mo agoExplain → -
pkgsite ⑂
Home of the pkg.xgo.dev website
Go ★ 1 8mo agoExplain → -
picolibc ⑂
picolibc - a C library designed for embedded 32- and 64- bit systems.
C ★ 1 9mo agoExplain → -
espressif-llvm-project-prebuilt
Prebuilt espressif LLVM with embed/wasm/native support
Shell ★ 1 9mo agoExplain → -
pseudo
GCSE Pseudocode Implementation
★ 1 9mo agoExplain → -
MazePlay
MazePlay - a game powered by XGo Builder
Shell ★ 1 7mo agoExplain → -
spbase
Basic Library for SPX
Go ★ 1 10mo agoExplain → -
delve ⑂
delve is a fork from github.com/go-delve/delve to support the Go/XGo programming language
Go ★ 1 11mo agoExplain → -
cjson ▣
LLGo wrapper of https://github.com/DaveGamble/cJSON
Go ★ 1 2y agoExplain → -
godot-old ⑂
Godot Engine – Multi-platform 2D and 3D game engine
C++ ★ 1 1y agoExplain → -
regexp
A feature-rich RegExp engine for Go+, compatible with Perl5 and .NET
Go ★ 1 1y agoExplain → -
setup-llgo
Set up your GitHub Actions workflow with a specific version of LLGo
TypeScript ★ 1 1y agoExplain → -
go2spx
No description.
Go ★ 1 1y agoExplain → -
better-gop-syntax ⑂
💾 📦 ✅
★ 1 3y agoExplain → -
goptests ⑂
Automatically generate Go+ test boilerplate from your source code.
★ 1 2y agoExplain → -
show
show.goplus.org
Go ★ 1 4y agoExplain → -
run
run.goplus.org
Go ★ 1 4y agoExplain → -
xtypes
Golang types convert utils
Go ★ 1 4y agoExplain → -
llarhub
LLAR Formula Repository
★ 0 3mo agoExplain → -
casdoor ⑂
An open-source UI-first Identity and Access Management (IAM) / Single-Sign-On (SSO) platform with web UI supporting OAuth 2.0, OIDC, SAML, CAS, LDAP, SCIM, WebAuthn, TOTP, MFA, Face ID, RADIUS, Google Workspace, Active Directory and Kerberos
Go ★ 0 8mo agoExplain → -
compiler-rt
A fork of compiler-rt from LLVM Project
C ★ 0 9mo agoExplain → -
gdspx.deprecated ▣
godot for spx
Go ★ 0 1y agoExplain → -
drivers
LLGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
Go ★ 0 11mo agoExplain → -
homebrew-core ⑂
🍻 Default formulae for the missing package manager for macOS (or Linux)
★ 0 2y agoExplain → -
gop-tools ⑂
Staticcheck - The advanced Go+ linter
★ 0 2y agoExplain → -
test-setup-goplus
Test goplus/setup-goplus
Go ★ 0 2y agoExplain → -
gtris ⑂
A tetris clone in Go+ using spx
★ 0 4y agoExplain → -
linguist ⑂
Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
★ 0 4y agoExplain → -
yaegi ⑂
Yaegi is Another Elegant Go Interpreter
Go ★ 0 4y agoExplain → -
gopbyexample ⑂
Go by Example
Go ★ 0 4y agoExplain → -
spxexample
No description.
JavaScript ★ 0 4y agoExplain →
No repos match these filters.