Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nathanmcmillan/hymn-lang
Small scripting language.
https://github.com/nathanmcmillan/hymn-lang
bytecode-interpreter c embedded interpreter language lua programming-language vm
Last synced: about 1 month ago
JSON representation
Small scripting language.
- Host: GitHub
- URL: https://github.com/nathanmcmillan/hymn-lang
- Owner: nathanmcmillan
- License: mpl-2.0
- Created: 2021-07-10T13:01:43.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-09-14T18:51:44.000Z (4 months ago)
- Last Synced: 2024-09-15T16:03:57.193Z (4 months ago)
- Topics: bytecode-interpreter, c, embedded, interpreter, language, lua, programming-language, vm
- Language: C
- Homepage: https://hymn-lang.org
- Size: 996 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hymn Scripting Language
A small byte-code interpreted language with a focus on simplicity. [Visit the website!](https://hymn-lang.org)
```
# 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
```# Why use Hymn
1. You want reference counting memory management. Memory is released deterministically, as soon as possible. There are no random garbage collection pauses in Hymn.
1. You feel programming paradigms like classes and interfaces add unnecessary complexity. Hymn only has strings, arrays, and tables.
1. You don't need namespaces. The Hymn `use` statement imports all variables and functions globally.
1. You want a scripting language with C like conventions: Brackets indicate scope, indices start at 0, and the not equals operator is `!=`
1. 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.# Development
## Principles
1. Portable C11 code that passes with `-Wall` `-Wextra` `-Werror` `-pedantic` flags
1. Small implementation under 10,000 total lines of C code
1. Reference counting memory management
1. Easy to learn syntax
1. No closures
1. No namespaces
1. No classes
1. No breaking changes after version 1.0# Performance
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 |