Giter VIP home page Giter VIP logo

wren-go's Introduction

wren-go

Wren scripting language in pure Go

Go Reference GoReportCard Wren

wren-go is a port of the Wren scripting language to pure Go using WebAssembly and wagu. Thanks to wagu, wren-go needs almost no dependencies and does not use CGo, making it easier to target web and tinygo targets.

Wren-go also uses a modified version of wren similar to wren-bindings-for-go meant for embedding in non C projects. This means theres no need to preallocate foreign functions and the VM.Exit function is meant to stop the wren VM in the middle of execution.

Installation

go get github.com/crazyinfin8/wren-go

Usage

func main() {
	cfg := wren.Config{
		WriteFn: func(vm wren.VM, message string) { fmt.Print(message) },
	}

	vm := wren.NewVM(cfg)

	vm.Interpret("main", `System.print("Hello from wren!")`)
}

Building wren-go

To build, run:

cd path/to/github.com/crazyinfin8/wren-go
go generate

this runs build-wren.go which:

  1. first fetches wren (requires git)
  2. generates the wren amalgamation file
  3. downloads WASI-libc (it has been buggy to download and run wasi-libc in one go using this script so you may need to run this script twice)
  4. compiles the wren amalgamation with src/shim.c to a webassembly binary using wasi-libc
  5. installs wagu
  6. generates the IR for wagu
  7. finally generates Go source code into the internals folder.

wren-go's People

Contributors

crazyinfin8 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.