{"id":28574581,"url":"https://github.com/goplus/xgo","last_synced_at":"2026-02-23T16:12:02.291Z","repository":{"id":37012078,"uuid":"47859258","full_name":"goplus/xgo","owner":"goplus","description":"XGo is the first AI-native programming language that integrates software engineering into a unified whole. Our vision is to enable everyone to become a builder of the world.","archived":false,"fork":false,"pushed_at":"2025-06-04T14:36:54.000Z","size":25436,"stargazers_count":9199,"open_issues_count":40,"forks_count":556,"subscribers_count":178,"default_branch":"main","last_synced_at":"2025-06-04T21:14:40.892Z","etag":null,"topics":["ai-native","data-science","golang","goplus","low-code","programming-language","scientific-computing","stem","stem-education","xgo"],"latest_commit_sha":null,"homepage":"https://xgo.dev","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goplus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-12-12T01:21:39.000Z","updated_at":"2025-06-04T21:06:46.000Z","dependencies_parsed_at":"2023-07-13T07:17:39.275Z","dependency_job_id":"5b69cd6e-57d9-4e30-8eb5-ae92c6651f3c","html_url":"https://github.com/goplus/xgo","commit_stats":{"total_commits":3020,"total_committers":43,"mean_commits":70.23255813953489,"dds":0.5201986754966887,"last_synced_commit":"0d9105af2308e9bd23506aacb24439e9cebd4d11"},"previous_names":["qiniu/goplus","qiniu/qlang","goplus/goplus","goplus/xgo","goplus/gop"],"tags_count":151,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goplus%2Fxgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goplus%2Fxgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goplus%2Fxgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goplus%2Fxgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goplus","download_url":"https://codeload.github.com/goplus/xgo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goplus%2Fxgo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259159618,"owners_count":22814490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-native","data-science","golang","goplus","low-code","programming-language","scientific-computing","stem","stem-education","xgo"],"created_at":"2025-06-10T22:00:59.154Z","updated_at":"2026-02-23T16:12:02.284Z","avatar_url":"https://github.com/goplus.png","language":"Go","funding_links":[],"categories":["Go","HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cp\u003e\u003c/p\u003e\n\u003cp\u003e\n    \u003cimg width=\"80\" src=\"https://xgo.dev/favicon.svg\"\u003e\n\u003c/p\u003e\n\u003ch1\u003eThe XGo Programming Language\u003c/h1\u003e\n\n\n[xgo.dev](https://xgo.dev) | [Docs](doc/docs.md) | [XGo vs. Go](doc/xgo-vs-go.md) | [Tutorials](https://tutorial.xgo.dev) | [Playground](https://play.xgo.dev) | [XGo REPL (iXGo)](https://repl.xgo.dev) | [Contributing \u0026 compiler design](doc/contributing.md)\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003c!--\n[![VSCode](https://img.shields.io/badge/vscode-XGo-teal.svg)](https://github.com/gopcode/vscode-goplus)\n[![Discord](https://img.shields.io/discord/983646982100897802?label=Discord\u0026logo=discord\u0026logoColor=white)](https://discord.gg/mYjWCJDcAr)\n[![Interpreter](https://img.shields.io/badge/interpreter-iXGo-seagreen.svg)](https://github.com/goplus/ixgo)\n--\u003e\n\n[![Build Status](https://github.com/goplus/xgo/actions/workflows/go.yml/badge.svg)](https://github.com/goplus/xgo/actions/workflows/go.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/goplus/xgo)](https://goreportcard.com/report/github.com/goplus/xgo)\n[![Coverage Status](https://codecov.io/gh/goplus/xgo/branch/main/graph/badge.svg)](https://codecov.io/gh/goplus/xgo)\n[![GitHub release](https://img.shields.io/github/v/tag/goplus/xgo.svg?label=release)](https://github.com/goplus/xgo/releases)\n[![Discord](https://img.shields.io/badge/Discord-online-success.svg?logo=discord\u0026logoColor=white)](https://discord.com/invite/mYjWCJDcAr)\n\n\u003c/div\u003e\n\nXGo 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.\n\n```\nXGo := C * Go * Python * JavaScript + Scratch\n```\n\nOur vision is to **enable everyone to become a builder of the world**.\n\n#### Easy to learn\n\n* Simple and easy to understand\n* Smaller syntax set than Go and Python in best practices\n\n#### Ready for large projects\n\n* Integrate C/C++, Go, Python, and JavaScript/TypeScript into a unified ecosystem\n* Derived from Go and easy to build large projects from its good engineering foundation\n\nThe XGo programming language is designed for engineering, STEM education, and data science.\n\n* **For engineering**: working in the simplest language that can be mastered by children.\n* **For STEM education**: studying an engineering language that can be used for work in the future.\n* **For data science**: communicating with engineers in the same language.\n\nFor more details, see [Quick Start](doc/docs.md).\n\n\n## Key Features of XGo\n\n* Approaching natural language expression and intuitive (see [How XGo simplifies Go's expressions](#how-xgo-simplifies-gos-expressions)).\n* Smallest but Turing-complete syntax set in best practices (see [The XGo Mini Specification](doc/spec-mini.md)).\n* Fully compatible with [Go](https://github.com/golang/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)).\n* Integrating with the C ecosystem including Python/JavaScript and providing limitless possibilities based on [LLGo](https://github.com/goplus/llgo) (see [Importing C/C++ and Python libraries](#importing-cc-and-python-libraries)).\n* 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)).\n\n\n## How XGo simplifies Go's expressions\n\nDifferent from the function call style of most languages, XGo recommends command style code:\n\n```coffee\nprintln \"Hello world\"\n```\n\nTo emphasize our preference for command style, we introduce `echo` as an alias for `println`:\n\n```coffee\necho \"Hello world\"\n```\n\nFor more discussion on coding style, see https://tutorial.xgo.dev/hello-world.\n\nCode 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:\n\n| Go code | XGo code | Note |\n| ---- | ---- | ---- |\n| package main\u003cbr\u003e\u003cbr\u003eimport \"fmt\"\u003cbr\u003e\u003cbr\u003efunc main() {\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;fmt.Println(\"Hi\")\u003cbr\u003e} | import \"fmt\"\u003cbr\u003e\u003cbr\u003efmt.Println(\"Hi\")\u003cbr\u003e | Program structure: XGo allows omitting `package main` and `func main` |\n| fmt.Println(\"Hi\") | echo(\"Hi\") | [More builtin functions](doc/builtin.md): It simplifies the expression of the most common tasks |\n| 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 |\n| name := \"Ken\"\u003cbr\u003efmt.Printf(\u003cbr\u003e\u0026nbsp;\u0026nbsp;\"Hi %s\\n\", name) | name := \"Ken\"\u003cbr\u003eecho \"Hi ${name}\" | [Goodbye printf](doc/goodbye-printf.md), use `${expr}` in [string](doc/string.md) literals |\n| a := []int{1, 2, 3} | a := [1, 2, 3] | [List/Slice](doc/slice.md) literals |\n| a = append(a, 4)\u003cbr\u003ea = append(a, 5, 6, 7) | a \u003c- 4\u003cbr\u003ea \u003c- 5, 6, 7 | Append values to a list |\n| a := map[string]int{\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\"Monday\": 1,\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\"Tuesday\": 2,\u003cbr\u003e} | a := {\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\"Monday\": 1,\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\"Tuesday\": 2,\u003cbr\u003e} | [Map](doc/map.md) literals |\n| OnStart(func() {\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;...\u003cbr\u003e}) | onStart =\u003e {\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;...\u003cbr\u003e} | [Lambda](doc/func-closure.md) expressions |\n| Play(\"1.mp3\", \u0026Options{Loop: true}) | play \"1.mp3\", loop = true | Python-like [keyword arguments](doc/func-closure.md#keyword-arguments) (kwargs) |\n| type Rect struct {\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Width\u0026nbsp; float64\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Height float64\u003cbr\u003e}\u003cbr\u003e | type Rect (width, height float64) | [Tuples vs. Structs](doc/struct-vs-tuple.md): We encourage using tuples to implement UDTs instead of structs. |\n| type Rect struct {\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Width\u0026nbsp; float64\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Height float64\u003cbr\u003e}\u003cbr\u003e\u003cbr\u003efunc (this *Rect) Area() float64 { \u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;return this.Width * this.Height\u003cbr\u003e} | var (\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Width\u0026nbsp; float64\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Height float64\u003cbr\u003e)\u003cbr\u003e\u003cbr\u003efunc Area() float64 { \u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;return Width * Height\u003cbr\u003e} | [XGo Classfiles](doc/classfile.md): We can express OOP with global variables and functions. |\n\nFor more details, see [The XGo Mini Specification](doc/spec-mini.md).\n\n\n## Importing C/C++ and Python libraries\n\nXGo can choose different Go compilers as its underlying support. Currently known supported Go compilers include:\n\n* [go](https://go.dev/) (The official Go compiler supported by Google)\n* [llgo](https://github.com/goplus/llgo) (The Go compiler supported by the XGo team)\n* [tinygo](https://tinygo.org/) (A Go compiler for small places)\n\nCurrently, XGo defaults to using [go](https://go.dev/) as its underlying support, but in the future, it will be [llgo](https://github.com/goplus/llgo).\n\nLLGo is a Go compiler based on [LLVM](https://llvm.org/) 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:\n\n* Game development\n* AI and data science\n* WebAssembly\n* Embedded development\n* ...\n\nIf you wish to use [llgo](https://github.com/goplus/llgo), specify the `-llgo` flag when initializing an XGo module:\n\n```sh\nxgo mod init -llgo YourModulePath\n```\n\nThis will generate a `go.mod` file with the following contents (It may vary slightly depending on the versions of local XGo and LLGo):\n\n```go\nmodule YourModulePath\n\ngo 1.21 // llgo 1.0\n\nrequire github.com/goplus/lib v0.2.0\n```\n\nBased on LLGo, XGo can import libraries written in C/C++ and Python.\n\nHere is an example (see [chello](demo/_llgo/chello/hello.xgo)) of printing `Hello world` using C's `printf`:\n\n```go\nimport \"c\"\n\nc.printf c\"Hello world\\n\"\n```\n\nHere, `c\"Hello world\\n\"` is a syntax supported by XGo, representing a null-terminated C-style string.\n\nTo run this example, you can:\n\n```sh\ncd YourModulePath  # set work directory to your module\nxgo mod tidy       # for generating go.sum file\nxgo run .\n```\n\nAnd here is an example (see [pyhello](demo/_llgo/pyhello/hello.xgo)) of printing `Hello world` using Python's `print`:\n\n```go\nimport \"py/std\"\n\nstd.print py\"Hello world\"\n```\n\nHere, `py\"Hello world\"` is a syntax supported by XGo, representing a Python string.\n\nHere are more examples of XGo calling C/C++ and Python libraries:\n\n* [pytensor](demo/_llgo/pytensor/tensor.xgo): a simple demo using [py/torch](https://pkg.go.dev/github.com/goplus/lib/py/torch)\n* [tetris](demo/_llgo/tetris/tetris.xgo): a tetris game based on [c/raylib](https://pkg.go.dev/github.com/goplus/lib/c/raylib)\n* [sqlitedemo](demo/_llgo/sqlitedemo/sqlitedemo.xgo): a demo using [c/sqlite](https://pkg.go.dev/github.com/goplus/lib/c/sqlite)\n\nTo find out more about LLGo/XGo's support for C/C++ and Python in detail, please refer to homepage of [llgo](https://github.com/goplus/llgo).\n\n\n## XGo Classfiles\n\n```\nOne language can change the whole world.\nXGo is a \"DSL\" for all domains.\n```\n\nRob 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.\n\nIn 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:\n\n```\nDon't define a language for specific domain.\nAbstract domain knowledge for it.\n```\n\nXGo introduces `classfile` and `class framework` to abstract domain knowledge.\n\n* [What's Classfile?](doc/classfile.md#whats-classfile)\n* [Dive into XGo Classfiles](doc/classfile.md)\n\nSound a bit abstract? Let's see some XGo class frameworks.\n\n* STEM Education: [spx: A Scratch Compatible 2D Game Engine](https://github.com/goplus/spx)\n* AI Programming: [mcp: An XGo implementation of the Model Context Protocol (MCP)](https://github.com/goplus/mcp)\n* AI Programming: [mcptest: An XGo MCP Test Framework](https://github.com/goplus/mcp/tree/main/mtest)\n* Web Programming: [yap: Yet Another HTTP Web Framework](https://github.com/goplus/yap)\n* Web Programming: [yaptest: An XGo HTTP Test Framework](https://github.com/goplus/yap/tree/main/ytest)\n* Web Programming: [ydb: An XGo Database Framework](https://github.com/goplus/yap/tree/main/ydb)\n* CLI Programming: [cobra: A Commander for modern XGo CLI interactions](https://github.com/goplus/cobra)\n* CLI Programming: [gsh: An alternative to write shell scripts](https://github.com/qiniu/x/tree/main/gsh)\n* Unit Test: [test: Unit Test](doc/classfile.md#class-framework-unit-test)\n\n\n### yap: Yet Another HTTP Web Framework\n\nThis classfile has the file suffix `.yap`.\n\nCreate a file named [get.yap](https://github.com/goplus/yap/blob/main/demo/classfile2_hello/get.yap) with the following content:\n\n```go\nhtml `\u003chtml\u003e\u003cbody\u003eHello, YAP!\u003c/body\u003e\u003c/html\u003e`\n```\n\nExecute the following commands:\n\n```sh\nxgo mod init hello\nxgo get github.com/goplus/yap@latest\nxgo mod tidy\nxgo run .\n```\n\nA simplest web program is running now. At this time, if you visit http://localhost:8080, you will get:\n\n```\nHello, YAP!\n```\n\nYAP 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).\n\nLet's create a file named [get_p_#id.yap](https://github.com/goplus/yap/blob/main/demo/classfile2_hello/get_p_%23id.yap) with the following content:\n\n```coffee\njson {\n\t\"id\": ${id},\n}\n```\n\nExecute `xgo run .` and visit http://localhost:8080/p/123, you will get:\n\n```\n{\"id\": \"123\"}\n```\n\nSee [yap: Yet Another HTTP Web Framework](https://github.com/goplus/yap) for more details.\n\n\n### spx: A Scratch Compatible 2D Game Engine\n\n![Screen Shot1](https://github.com/goplus/spx/blob/v1/tutorial/01-Weather/1.jpg) ![Screen Shot2](https://github.com/goplus/spx/blob/v1/tutorial/01-Weather/2.jpg)\n\nThrough this example you can learn how to implement dialogues between multiple actors.\n\nHere are some codes in [Kai.spx](https://github.com/goplus/spx/blob/v1/tutorial/01-Weather/Kai.spx):\n\n```coffee\nonStart =\u003e {\n\tsay \"Where do you come from?\", 2\n\tbroadcast \"1\"\n}\n\nonMsg \"2\", =\u003e {\n\tsay \"What's the climate like in your country?\", 3\n\tbroadcast \"3\"\n}\n```\n\nWe 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.\n\nWhen the program starts, Kai says `Where do you come from?`, and then broadcasts the message `1`. Who will recieve this message? Let's see codes in [Jaime.spx](https://github.com/goplus/spx/blob/v1/tutorial/01-Weather/Jaime.spx):\n\n```coffee\nonMsg \"1\", =\u003e {\n\tsay \"I come from England.\", 2\n\tbroadcast \"2\"\n}\n```\n\nYes, Jaime recieves the message `1` and says `I come from England.`. Then he broadcasts the message `2`. Kai recieves it and says `What's the climate like in your country?`.\n\nThe following procedures are very similar. In this way you can implement dialogues between multiple actors.\n\nSee [spx: A Scratch Compatible 2D Game Engine](https://github.com/goplus/spx) for more details.\n\n\n### gsh: XGo DevOps Tools\n\nYes, now you can write `shell script` in XGo. It supports all shell commands.\n\nLet's create a file named [example.gsh](https://github.com/qiniu/x/blob/main/gsh/demo/hello/example.gsh) and write the following code:\n\n```coffee\nmkdir \"testgsh\"\n```\n\nDon't need a `go.mod` file, just enter `xgo run ./example.gsh` directly to run.\n\nSee [gsh: XGo DevOps Tools](https://github.com/qiniu/x/tree/main/gsh) for more details.\n\n\n## How to install\n\nNote: Requires go1.19 or later\n\n### on Windows\n\n```sh\nwinget install goplus.xgo\n```\n\n### on Debian/Ubuntu\n\n```sh\nsudo bash -c ' echo \"deb [trusted=yes] https://pkgs.xgo.dev/apt/ /\" \u003e /etc/apt/sources.list.d/goplus.list'\nsudo apt update\nsudo apt install xgo\n```\n\n### on RedHat/CentOS/Fedora\n\n```sh\nsudo bash -c 'echo -e \"[goplus]\\nname=XGo Repo\\nbaseurl=https://pkgs.xgo.dev/yum/\\nenabled=1\\ngpgcheck=0\" \u003e /etc/yum.repos.d/goplus.repo'\nsudo yum install xgo\n```\n\n### on macOS/Linux (Homebrew)\n\nInstall via [brew](https://brew.sh/)\n\n```sh\n$ brew install xgo\n```\n\n### from source code\n\n```bash\ngit clone https://github.com/goplus/xgo.git\ncd xgo\n\n# On mac/linux run:\n./all.bash\n# On Windows run:\nall.bat\n```\n\n## XGo Applications\n\n### Game Programming\n\n* [A Scratch Compatible 2D Game Engine](https://github.com/goplus/spx)\n* [Aircraft War](https://github.com/goplus/AircraftWar)\n* [Flappy Bird](https://github.com/goplus/FlappyCalf)\n* [Maze Play](https://github.com/goplus/MazePlay)\n* [BetaGo](https://github.com/xushiwei/BetaGo)\n* [Gobang](https://github.com/xushiwei/Gobang)\n* [Dinosaur](https://github.com/xushiwei/Dinosaur)\n\n### Web Programming\n\n* [yap: Yet Another HTTP Web Framework](https://github.com/goplus/yap)\n* [yaptest: HTTP Test Framework](https://github.com/goplus/yap/tree/main/ytest)\n* [ydb: Database Framework](https://github.com/goplus/yap#ydb-database-framework)\n\n### DevOps Tools\n\n* [gsh: XGo DevOps Tools](https://github.com/qiniu/x/tree/main/gsh)\n\n### Data Processing\n\n* [hdq: HTML DOM Query Language for XGo](https://github.com/goplus/hdq)\n\n\n## IDE Plugins\n\n* vscode: [Go/XGo for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=goplus.gop)\n\n\n## Contributing\n\nThe XGo project welcomes all contributors. We appreciate your help!\n\nFor more details, see [Contributing \u0026 compiler design](doc/contributing.md).\n\n\n## Give a Star! ⭐\n\nIf you like or are using XGo to learn or start your projects, please give it a star. Thanks!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoplus%2Fxgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoplus%2Fxgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoplus%2Fxgo/lists"}