真能折腾:用Rust实现一个Go脚本语言
2021-09-30 12:32:00 Author: mp.weixin.qq.com(查看原文) 阅读量:26 收藏

在 GitHub 发现一个项目:goscript,这个项目挺有意思。它计划实现 Go 语言规范,同时增加一些动态语言特性,打造一个类似 Python 或 Lua 这样的动态语言,但语法是 Go 语言的。

这个项目是使用 Rust 实现的,一方面希望可以像 Lua 一样被嵌入使用,比如嵌入 Rust 中;另一方面也希望像 Python 一样,可以单独作为脚本语言使用。

项目地址:https://github.com/oxfeeefeee/goscript,Star 数:782,去年 4 月份启动的项目。(目测我这一推广,Star 数增加不少,

目前官方提供了一种方式进行试验:

The project "engine" is the entry/wrapper. there are test cases in here[1] to browse through.

  • Make sure your Rust installation is up to date.
  • Clone this repository.
  • Go to goscript/engine
  • Run cargo test -- --nocapture

扒了一下,发现这个项目的作者是国人。如果你对这块感兴趣可以关注下!

此外,该项目还有具体应用。我们知晓,Go 官方的 Playground,Go 的编译运行是服务端处理的。但有一个 Playground:https://go-playground-wasm.vercel.app/,它是在浏览器运行 Go 代码,也就是访问这个网址后,即使断网了,也可以运行 Go 代码。这个项目使用的就是 goscript 和 WASM。

文末「阅读原文」可以直达项目首页。

参考资料

[1]

here: https://github.com/oxfeeefeee/goscript/tree/master/engine/tests

推荐阅读

觉得不错,点个赞吧

扫码关注「Rust编程指北


文章来源: http://mp.weixin.qq.com/s?__biz=MzAxNzY0NDE3NA==&mid=2247488306&idx=1&sn=3a6fa680f95ec4fe5fff893a9513e92b&chksm=9be33cd3ac94b5c5f7eb15c63d5994c8d114f299601293ce702b4365f65bb3c3c78be7b94682#rd
如有侵权请联系:admin#unsafe.sh