SkillAgentSearch skills...

Xgo

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.

Install / Use

/learn @goplus/Xgo

README

<div align="center"> <p></p> <p> <img width="80" src="https://xgo.dev/favicon.svg"> </p> <h1>The XGo Programming Language</h1>

xgo.dev | Docs | XGo vs. Go | Tutorials | Playground | XGo REPL (iXGo) | Contributing & compiler design

</div> <div align="center"> <!-- [![VSCode](https://img.shields.io/badge/vscode-XGo-teal.svg)](https://github.com/gopcode/vscode-goplus) [![Discord](https://img.shields.io/discord/983646982100897802?label=Discord&logo=discord&logoColor=white)](https://discord.gg/mYjWCJDcAr) [![Interpreter](https://img.shields.io/badge/interpreter-iXGo-seagreen.svg)](https://github.com/goplus/ixgo) -->

Build Status Go Report Card Coverage Status GitHub release Discord

</div>

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

The XGo programming language is designed for engineering, STEM education, and data science.

  • 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.

For more details, see Quick Start.

Key Features of XGo

How XGo simplifies Go's expressions

Different from the function call style of most languages, XGo recommends command style code:

println "Hello world"

To emphasize our preference for command style, we introduce echo as an alias for println:

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 main<br><br>import "fmt"<br><br>func main() {<br>    fmt.Println("Hi")<br>} | import "fmt"<br><br>fmt.Println("Hi")<br> | Program structure: XGo allows omitting package main and func main | | fmt.Println("Hi") | echo("Hi") | More builtin functions: It simplifies the expression of the most common tasks | | fmt.Println("Hi") | echo "Hi" | Command-line style code: It reduces the number of parentheses in the code as much as possible, making it closer to natural language | | name := "Ken"<br>fmt.Printf(<br>  "Hi %s\n", name) | name := "Ken"<br>echo "Hi ${name}" | Goodbye printf, use ${expr} in string literals | | a := []int{1, 2, 3} | a := [1, 2, 3] | List/Slice literals | | a = append(a, 4)<br>a = append(a, 5, 6, 7) | a <- 4<br>a <- 5, 6, 7 | Append values to a list | | a := map[string]int{<br>    "Monday": 1,<br>    "Tuesday": 2,<br>} | a := {<br>    "Monday": 1,<br>    "Tuesday": 2,<br>} | Map literals | | OnStart(func() {<br>    ...<br>}) | onStart => {<br>    ...<br>} | Lambda expressions | | Play("1.mp3", &Options{Loop: true}) | play "1.mp3", loop = true | Python-like keyword arguments (kwargs) | | type Rect struct {<br>    Width  float64<br>    Height float64<br>}<br> | type Rect (width, height float64) | Tuples vs. Structs: We encourage using tuples to implement UDTs instead of structs. | | type Rect struct {<br>    Width  float64<br>    Height float64<br>}<br><br>func (this *Rect) Area() float64 { <br>    return this.Width * this.Height<br>} | var (<br>    Width  float64<br>    Height float64<br>)<br><br>func Area() float64 { <br>    return Width * Height<br>} | XGo Classfiles: We can express OOP with global variables and functions. |

For more details, see The XGo Mini Specification.

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)

Currently, XGo defaults to using go as its underlying support, but in the future, it will be llgo.

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
  • ...

If you wish to use llgo, specify the -llgo flag when initializing an XGo module:

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):

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) of printing Hello world using C's printf:

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:

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) of printing Hello world using Python's print:

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:

To find out more about LLGo/XGo's support for C/C++ and Python in detail, please refer to homepage of llgo.

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.

Sound a bit abstract? Let's see some XGo class frameworks.

Related Skills

View on GitHub
GitHub Stars9.4k
CategoryData
Updated9h ago
Forks562

Languages

Go

Security Score

100/100

Audited on Mar 26, 2026

No findings