A lightweight, expressive scripting language powered by VoltVM
Watt is a dynamically typed scripting language that combines functional and object-oriented programming paradigms. β‘ It is designed to be expressive, flexible, and easy to use for scripting and application development.
- π Dynamically typed
- π§ FP + OOP
- πͺΆ Clean syntax
- βοΈ Compiled to bytecode (VoltVM)
- π Built-in reflection support
- π Easy to learn
Watt is compiled to its own virtual machine, VoltVM. Volt VM brings:
- Great flexibility π§©
- Good performance π
- Nice reflection πͺ
A few simple programs to show the expressive power of Watt.
β¨ Watt files use the
.wtextension.
π More examples live insrc/test/watt/examples
πͺΆ hello_world.wt
import 'std.io'
io.println('Hello, world!')πͺΆ pie_recipe.wt
import 'std.io'
import 'std.convert'
type Pie(weight) {
fun cook() {
io.println('π₯§ Cooking pie...')
io.println('β‘ Pie cooked! Weight: '
+ convert.to_string(weight)
)
}
}
unit Bakery {
fun bake(pies) {
io.println('πͺ Cooking: ')
for i in 0..pies.size() {
pies.get(i).cook()
}
io.println('π Successfully cooked all pies!')
}
}
pies := [new Pie(3.6)]
Bakery.bake(pies)πͺΆ fibonacci.wt
fun fib(n) {
cache := {}
fun fib_inner(n) {
if n <= 1 {
return n
}
if cache.has_key(n) {
return cache.get(n)
}
result := fib_inner(n - 1) + fib_inner(n - 2)
cache.set(n, result)
return result
}
return fib_inner(n)
}
io.println(fib(1000))Work in progress... Stay tuned! π οΈ π Official Docs (coming soon)
Big thanks to all contributors and enthusiasts! Feel free to βοΈ star the project, give feedback, or contribute!