A small byte-code interpreted language with a focus on simplicity. Visit the website!
# import additional scripts
use "math"
# tables hold key value pairs
func new-node(value) {
return { value: value, next: none }
}
func node-add(list, value) {
set node = list
while true {
if node.next == none { break }
node = node.next
}
node.next = new-node(value)
}
# objects are passed by reference
set list = new-node("hello")
node-add(list, "world")
# print statements will show all nested values in an object
echo list
- You want reference counting memory management. Memory is released deterministically, as soon as possible. There are no random garbage collection pauses in Hymn.
- You feel programming paradigms like classes and interfaces add unnecessary complexity. Hymn only has strings, arrays, and tables.
- You don't need namespaces. The Hymn
use
statement imports all variables and functions globally. - You want a scripting language with C like conventions: Brackets indicate scope, indices start at 0, and the not equals operator is
!=
- You're weary keeping up with evolving programming languages. Hymn is small and will stay small. There will not be significant changes to the core language and built-in functions.
- Portable C11 code that passes with
-Wall
-Wextra
-Werror
-pedantic
flags - Small implementation under 10,000 total lines of C code
- Reference counting memory management
- Easy to learn syntax
- No closures
- No namespaces
- No classes
- No breaking changes after version 1.0
AMD Ryzen 5 1600 6 core 3.2 GHz - Windows 10 using Ubuntu WSL
Test | Factors | Fib | List | Loop | Objects | Primes | Tail |
---|---|---|---|---|---|---|---|
Hymn | 1.92s | 2.15s | 2.25s | 1.17s | 3.64s | 1.21s | 4.28s |
Lua | 1.14s | 1.16s | 1.98s | 0.72s | 4.66s | 0.81s | 1.81s |
Python | 3.98s | 2.27s | 2.63s | 1.28s | 4.68s | 2.59s | - |
Node | 0.69s | 0.10s | 0.68s | 0.45s | 1.77s | 0.19s | - |
Lua JIT | 0.08s | 0.11s | 0.56s | 0.28s | 1.20s | 0.06s | 0.03s |