Anaconda developers recently released PyScript, a framework that allows developers to mix Python code into HTML, which some have called “JSP for Python”. In fact, PyScript uses WebAssembly for its underlying layer, as it is built on Pyodide, which consists of a CPython 3.8 interpreter compiled into WebAssembly that allows Python to be run in a web browser.
It’s no coincidence that the developers have adopted the same idea to make Go run smoothly on the browser as well. https://goscript.dev The website supports running Go code directly in the browser, a Go playground with Goscript under the hood, implemented via WASM.
Goscript is an unofficial implementation of the Go language specification for inlining or wrapping Rust projects, providing a simpler way to wrap and call the underlying Rust code. It is like Lua is to Redis/WoW, or Python is to NumPy.
Goscript contains six items.
parserturns the source code into an AST, ported from the official Go code.
type checkerdoes type pushing and type checking based on AST, also ported from the official Go code.
codegenGenerate bytecode based on AST and type information.
stdOfficial library, ported from the official Go library.
engineContains the native part of the official library, plus a simple wrapper.
Goscript implements almost all of Go’s features (pre 1.18, so not including generics) and ports some of the official libraries, see https://github.com/oxfeeefeee/goscript/tree/master/engine/tests for passed test cases.
Goscript project code: https://github.com/oxfeeefeee/goscript