Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/helje5/wren-swift
The wren scripting language as a Swift package, w/ some Swift API wrappers
https://github.com/helje5/wren-swift
Last synced: about 1 month ago
JSON representation
The wren scripting language as a Swift package, w/ some Swift API wrappers
- Host: GitHub
- URL: https://github.com/helje5/wren-swift
- Owner: helje5
- License: apache-2.0
- Created: 2021-01-18T23:20:25.000Z (about 4 years ago)
- Default Branch: develop
- Last Pushed: 2021-01-19T20:41:40.000Z (about 4 years ago)
- Last Synced: 2024-12-04T01:36:44.658Z (about 2 months ago)
- Language: C
- Size: 130 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# swift-wren
A Swift package and wrapper for the [wren](https://wren.io) scripting language.
There is a good [QA](https://wren.io/qa.html) 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](https://github.com/wren-lang/wren/issues/487)
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](https://wren.io/qa.html):
```wren
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:
```swift
let vm = WrenVM()
try vm.interpret(
"""
System.print("I'm running in a VM!")
"""
)
```Using dynamicCallable:
```swift
let vm = WrenVM()
try vm.main.System.print("Hello World!")
```### Links
- [wren](https://wren.io)
- [QA](https://wren.io/qa.html)### Who
**swift-wren** is brought to you by
the
[Always Right Institute](https://www.alwaysrightinstitute.com)
and
[ZeeZide](http://zeezide.de).
We like
[feedback](https://twitter.com/ar_institute),
GitHub stars,
cool [contract work](http://zeezide.com/en/services/services.html),
presumably any form of praise you can think of.