The Toy Scripting Language is an imperative, bytecode-interpreted, embeddable scripting language. Rather than functioning independently, it serves as part of another program, the “host”. This design allows for straightforward customization by both the host’s developers and end users, achieved by exposing program logic through external scripts.
Nifty Features
- Simple C-like syntax
- Intermediate AST and bytecode representations
- Strong, but optional type system
- First-class functions and closures
- Extensible with native C-bindings
- Can re-direct output, error and assertion messages
- Open-Source under the zlib license
Syntax
fn makeCounter() {
var counter: Int = 0;
fn increment() {
return ++counter;
}
return increment;
}
//'tally' holds internal state
var tally = makeCounter();
for (var result = 0; result < 10; result = tally()) {
print result;
}
Toy In Action
I’m currently developing a game using Toy as a primary component, which can be found here:
https://gitea.krgamestudios.com/krgamestudios/ToyBox
Further Reading
This website is a work in progress - for further info, see the official repository: https://gitea.krgamestudios.com/krgamestudios/Toy, or the GitHub mirror: https://github.com/krgamestudios/Toy.