Skip to content
/ wat Public

WATT πŸ’‘ - functional programming language, written in java.

Notifications You must be signed in to change notification settings

kilwatt/wat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

334 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑🍹 Watt

A lightweight, expressive scripting language powered by VoltVM

Version Build License Language

πŸ€” About

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.

✨ Features

  • πŸ”„ Dynamically typed
  • 🧠 FP + OOP
  • πŸͺΆ Clean syntax
  • βš™οΈ Compiled to bytecode (VoltVM)
  • πŸ” Built-in reflection support
  • πŸ˜‹ Easy to learn

πŸš€ New

Watt is compiled to its own virtual machine, VoltVM. Volt VM brings:

  • Great flexibility 🧩
  • Good performance πŸ‡
  • Nice reflection πŸͺž

πŸ’‘ Examples

A few simple programs to show the expressive power of Watt.

✨ Watt files use the .wt extension.
πŸ“‚ More examples live in src/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))

πŸ“š Documentation

Work in progress... Stay tuned! πŸ› οΈ πŸ“– Official Docs (coming soon)

❀️ Thanks

Big thanks to all contributors and enthusiasts! Feel free to ⭐️ star the project, give feedback, or contribute!

About

WATT πŸ’‘ - functional programming language, written in java.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •