Skip to content

ttema4/hooda-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HooDA Language

HooDA is a statically typed programming language designed for efficient execution on a custom stack-based Virtual Machine with JIT compilation and Garbage Collection support.

Language Features

  • Syntax: Classic C/Java-style syntax with standard control structures (if, while, for, return).
  • Type System: Strongly typed. Supports int (signed 64-bit), bool, and reference-based arrays (int[], bool[]).
  • Memory Management: Automatic memory management via a Mark-and-Sweep Garbage Collector. Arrays are allocated on the heap.
  • Virtual Machine: Stack-based architecture using Tagged Pointers to distinguish between primitives (Tag=0) and references (Tag=1).
  • Performance:
    • AOT approach: Provides up to 20x performance improvement.
    • JIT compilation: Provides ~3x average performance improvement for hot paths.
  • Built-ins (Intrinsics):
    • print(val): Output value to stdout.
    • len(arr): Get the length of an array.
    • sqrt_upper(val): Calculate ceiling square root.
    • rand(min, max): Generate a random integer in the range [min, max].

Build:

cmake -B build && cmake --build build

Usage:

Binaries comp-hooda and vm-hooda are created in the project root:

  • Compilation:

    ./comp-hooda <path/to/program.txt> [path/to/result.bin]

    Example:

    ./comp-hooda programs/task1.txt

    Creates programs/task1.bin next to the source file.

  • Execution:

    ./vm-hooda <path/to/program.bin> [--no-jit]

    Example:

    ./vm-hooda programs/task1.bin

    Runs programs/task1.bin with JIT optimizations enabled.

Test:

ctest --test-dir build

Documentation:

About

A statically typed programming language featuring a custom stack-based VM with Arm64 JIT compilation and Mark-and-Sweep Garbage Collection.

Topics

Resources

License

Stars

Watchers

Forks

Contributors