Skip to content

AbduazizZiyodov/gustav

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

187 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fallback image description

bruh CI

Too heavy for its own good.

Important

Work in progress. You can refer to legacy tree walk interpreter implementation in Python for full language.

About

Experimental programming language with its own VM implemented in C.

Build

./build.sh

This creates 4 binaries: debug, release, valgrind & valgrind (with GC stress enabled)

Usage

Sample program(BST), create file named test.gus:

class Tree {
    init(value) {
        this.value = value; this.left = this.right = nil;
    }

    insert(value) {
        if (value < this.value) {
            if (this.left == nil) { this.left = Tree(value); } 
            else { this.left.insert(value); }
        } else {
            if (this.right == nil) { this.right = Tree(value); }
            else { this.right.insert(value); }
        }
    }
}

fun binary_search(node, value) {
    if (node == nil) return false;

    if (node.value == value) return true;

    if (value < node.value) return binary_search(node.left, value);

    return binary_search(node.right, value);
}

var root = Tree(10);

root.insert(5); root.insert(15); root.insert(3); root.insert(7);

print Tree;
print root;
print binary_search(root, 7);
print binary_search(root, 15);
print binary_search(root, 12);
print binary_search(root, 5);
[gustav] # ./target/gustav_release test.gus
Gustav v2.0 (May 17 2026 00:18:33) [ Debian Clang 19.1.7 (3+b1) ] | optimized RELEASE build for "Linux x86_64"

Tree
Tree<Instance>
true
true
false
true

Testing

Install pytest via uv (or whataver):

uv tool install pytest
pytest -vv tests

About

A bytecode VM for a dynamically typed language, implemented in C

Topics

Resources

License

Stars

5 stars

Watchers

1 watching

Forks

Contributors