Go to file
Helge Heß 3b47faaaf4
Update README.md
It kinda is complete, just some stuff missing :-)
2021-01-19 21:41:39 +01:00
.github/workflows Boilerplate 2021-01-19 00:29:40 +01:00
Sources Add value convertibles 2021-01-19 01:47:33 +01:00
Tests Add value convertibles 2021-01-19 01:47:33 +01:00
.gitignore Boilerplate 2021-01-19 00:29:40 +01:00
CONTRIBUTING.md Add a license 2021-01-19 01:38:23 +01:00
LICENSE Add a license 2021-01-19 01:38:23 +01:00
Package.swift Get CWren up and tested 2021-01-19 00:39:53 +01:00
README.md Update README.md 2021-01-19 21:41:39 +01:00

README.md

swift-wren

A Swift package and wrapper for the wren scripting language. There is a good QA on wren. It's a very small embeddable language similar to Lua, but w/o the weirdness.

A major thing missing in wren is reentrancy with the host environment. Another issue is that host functions do not get any function environment, i.e. no function specific userdata pointer, or other means which would allow a trampoline. PRs are still welcome, and we'll see where wren is going in the future.

This SwiftPM package embeds Wren itself, i.e. it contains the amalgation in a vendored branch.

What does it look like?

The example from the QA:

class Account {
  construct new(balance) { _balance = balance }
  withdraw(amount) { _balance = _balance - amount }
}

var account = Account.new(1000)
account.withdraw(100)

What does the Swift Wrapper look like

Hello world:

let vm = WrenVM()
try vm.interpret(
  """
  System.print("I'm running in a VM!")
  """
)

Using dynamicCallable:

let vm = WrenVM()
try vm.main.System.print("Hello World!")

Who

swift-wren is brought to you by the Always Right Institute and ZeeZide. We like feedback, GitHub stars, cool contract work, presumably any form of praise you can think of.