{"id":13611780,"url":"https://github.com/oxfeeefeee/goscript","last_synced_at":"2025-05-14T20:09:51.197Z","repository":{"id":37684557,"uuid":"108104739","full_name":"oxfeeefeee/goscript","owner":"oxfeeefeee","description":"An alternative implementation of Golang specs, written in Rust for embedding or wrapping.","archived":false,"fork":false,"pushed_at":"2023-09-12T02:36:32.000Z","size":3892,"stargazers_count":1537,"open_issues_count":4,"forks_count":61,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-05-14T14:40:16.537Z","etag":null,"topics":["golang","parser","programing-language","rust","scripting-language","vm"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oxfeeefeee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-10-24T09:23:13.000Z","updated_at":"2025-04-24T02:21:58.000Z","dependencies_parsed_at":"2024-01-14T06:51:26.047Z","dependency_job_id":"e980cde4-4502-426b-b6a5-d207bee86c79","html_url":"https://github.com/oxfeeefeee/goscript","commit_stats":{"total_commits":782,"total_committers":6,"mean_commits":"130.33333333333334","dds":0.008951406649616356,"last_synced_commit":"be49665c5536fa6631af67826220ef18ea6e7610"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxfeeefeee%2Fgoscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxfeeefeee%2Fgoscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxfeeefeee%2Fgoscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxfeeefeee%2Fgoscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oxfeeefeee","download_url":"https://codeload.github.com/oxfeeefeee/goscript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254183849,"owners_count":22028586,"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":["golang","parser","programing-language","rust","scripting-language","vm"],"created_at":"2024-08-01T19:02:07.188Z","updated_at":"2025-05-14T20:09:51.179Z","avatar_url":"https://github.com/oxfeeefeee.png","language":"Rust","funding_links":[],"categories":["Rust","golang"],"sub_categories":[],"readme":"# Goscript  \n\nAn alternative implementation of Golang specs, written in Rust for embedding or wrapping.\n\n[中文](#Goscript_Readme_中文版)\n\n## Website\n\n\u003chttps://goscript.dev/\u003e\n\n## What\n\n+ In other words, it's just another flavor of Go.\n+ It's designed to work with other Rust code in the case where you want to offer the users of your library/app the ability to use a \"simpler\" language to call the native (Rust) code, like what Lua is for Redis/WoW, or Python for NumPy/Sublime Text.\n\n## Why\n\n+ It's native to Rust, and your Rust project is looking for a scripting language.\n+ Go is nice and easy and you are familiar with it.\n+ To Rust programmers, it should be very well understood that compiler helps, as a strictly typed language, Goscript's type checker helps a lot compared to dynamically type languages, especially when your codebase gets larger.\n\n## How\n\n[Goscript Internals I: Overview](https://goscript.dev/posts/goscript_internals_I_overview_en)\n\n## When\n\n+ This readme update serves as an alpha release announcement.\n+ Almost all the language features are implemented as per the specs(pre-1.18, i.e. excluding generics).\n+ Part of the standard library is ported, which is not fully working.\n+ There are still a lot of work to be done besides libraries, like API cleanup, Documentation, and a lot more test cases.\n+ Overall it's considered buggy although it passes dozens of test [cases](https://github.com/oxfeeefeee/goscript/tree/master/engine/tests).\n+ A beta release is expected in about a year from now.\n\n## Who\n\n+ email: [`pb01005051` at Gmail](mailto:pb01005051@gmail).\n+ discord: [join](https://discord.gg/tYwqXEhVqa)\n\n## FAQ\n\n+ Is this a new language?\n\n  No, this is Go by definition. You can think of it as a hybrid of Go and Python, it takes the design of Go and implements it the way Python does. So, I think it's also fair to call it a scripting language.\n\n+ Why not a new language?\n\n  It's much easier to implement a language than to design one, I don't think I'm able to design a language that people would invest their time to learn. Go may be not perfect as a scripting language, but to me it works Ok.\n\n+ Why not just use Python/Lua (with Rust)?\n\n  People will/do, and Goscript can be a reasonable alternative, a strong type system can be a friend not enemy of your creativity.\n\n+ Is Goscript fast/slow?\n\n  I'm afraid it may be slower than you think. It's a VM based implementation without JIT, so there is an upper bound. Also, there is a tradeoff between performance and project complexity, we don't want a embedding language to be too big. For now, you can only expect a performance comparable to Python, I'm not sure how far we'll go with optimization in the long term.\n\n+ Does Goscript support multi-threading/parallelization?\n\n  No, that'd hurt single-thread performance and make things a lot harder to implement. I guess that's also why Python/Lua doesn't support parallelization. But it supports concurrency exceptionally well via goroutine :). It's also possible to introduce parallelization with libraries in the future.\n\n+ When can we actually use Goscirpt?\n\n  As mentioned above, I hope we can get it production ready in a year. I started this project three years ago, and I'll do my best not to abandon it.\n\n+ How can I help?\n\n  + Report issues.\n  + Send a PR if it's a minor fix.\n  + If you plan to contribute complex changes, please contact me for a discussion first.\n\n## Just want to see if it does run Go code\n\n+ Make sure your Rust installation is up to date.\n+ Clone this repository.\n+ Go to goscript/engine\n+ Put whatever you want in [temp.gos](https://github.com/oxfeeefeee/goscript/tree/master/engine/tests/std/temp.gos)\n+ Run `cargo test temp -- --nocapture`\n+ Or it should be trivial to make an executable that runs Go code following [test.rs](https://github.com/oxfeeefeee/goscript/tree/master/engine/tests/test.rs)\n+ Your code doesn't run? sorry, you can take a look at what do run in the test folder.\n\n-----------------\n\n# Goscript_Readme_中文版\n\nGo语言规范非的官方实现，用于Rust项目的内嵌或封装。\n\n## 网站\n\n\u003chttps://goscript.dev/\u003e\n\n## 啥？\n\n+ 简单地说，它是另一个风味的Go语言。\n+ 其作用是用于其他的Rust项目，有时候你需要用一个更简单的语言封装和调用底层的Rust代码。就像Lua之于Redis/WoW，或者Python之于NumPy/Sublime Text。\n\n## 为？\n\n+ 当你的Rust项目需要一个用Rust写的脚本语言。\n+ Go语言简单易学且已经被广泛使用。\n+ Rust程序员应该已经体会到编译器是编程助手，作为一个严格类型的语言，Goscript相对于其他动态语言更能帮你写好程序，特别是代码量变大的时候。\n\n## 咋？\n\n[Goscript 设计原理一: 总览](https://goscript.dev/posts/goscript_internals_I_overview_zh)\n\n## 时？\n\n+ 本次readme更新可以看作是alpha版本发布。\n+ 几乎所有的语言特性都实现了(pre-1.18版本，即不包含范型)。\n+ 移植了部分官方库，且这部分也没完全好。\n+ 还有很多其他工作要做，比如API整理，文档，大量完备的测试用例等。\n+ 总体上bug可能还不少，但是已经能通过很多[测试用例](https://github.com/oxfeeefeee/goscript/tree/master/engine/tests)。\n+ 预期在一年以内发布beta版本。\n\n## 谁？\n\n+ email: [`pb01005051` at Gmail](mailto:pb01005051@gmail).\n+ discord: [加入](https://discord.gg/tYwqXEhVqa)\n\n## 问\n\n+ 这是个新语言吗?\n\n  不是，因为它实现了Go语言的规范，所以理论上就是Go语言（的一种）。它可以看作是一个Go和Python的混血：用Python语言的实现方式实现了Go语言。所以你叫它脚本语言也对。\n\n+ 为什么不弄个新语言?\n\n  设计一门语言比实现一门语言难多了，自认为没有能力设计一门语言好到能让其他程序员愿意学习它的新的“更好的”语法。Go作为脚本语言可能不完美，但是我觉得够用。\n\n+ 为什么不直接用 Python/Lua (在Rust项目中)?\n\n  大家会用Python/Lua的, Goscirpt只是提供了另外一个选项，强类型系统可以帮你写好代码而不是限制你。\n\n+ Goscript快吗/慢吗?\n\n  可能比你想象的要慢。它是没有JIT的基于虚拟机运行的，性能上存在上限，而且我们需要在性能和复杂度上找平衡，不希望它大到不适合被嵌入。目前我们只能期望一个跟Python相当的性能，远期优化能做到什么地步目前不好预测。\n\n+ Goscirpt支持多线程/并行吗?\n\n  不支持，因为多线程支持会降低单线程的性能，并且写起来也复杂很多。我猜这也是Python/Lua不支持并行的原因。不过对并发的支持是无与伦比的好:)，因为有goroutine。不排除将来用库的方式支持并行。\n\n+ 什么时候能真正用?\n\n  如前面提到的，我希望能在一年内达到生产可用的成熟度。这个项目是三年前开始的，我会尽可能完成它。\n\n+ 可以怎么参与项目？\n\n  + 提issue。\n  + 小的改动可以直接提PR。\n  + 大的改动请先联系我讨论一下。\n\n## 就想跑点Go代码试试\n\n+ 安装最新版的Rust。\n+ Clone本项目。\n+ 到goscript/engine目录。\n+ 在[temp.gos](https://github.com/oxfeeefeee/goscript/tree/master/engine/tests/std/temp.gos) 写你想写的Go代码。\n+ 运行 `cargo test temp -- --nocapture`\n+ 或者参照[test.rs](https://github.com/oxfeeefeee/goscript/tree/master/engine/tests/test.rs) 弄个可以执行Go代码的exe。\n+ 你的代码跑不了？不好意思，不过你可以看看测试文件夹里那些可以跑的代码。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxfeeefeee%2Fgoscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foxfeeefeee%2Fgoscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxfeeefeee%2Fgoscript/lists"}