An open API service indexing awesome lists of open source software.

https://github.com/a-boring-square/thorium

A statically-typed functional language compiling to Lisp-inspired bytecode, running on a custom VM.
https://github.com/a-boring-square/thorium

bytecode-compiler bytecode-virtual-machine functional-programming programming-language virtual-machine

Last synced: 2 months ago
JSON representation

A statically-typed functional language compiling to Lisp-inspired bytecode, running on a custom VM.

Awesome Lists containing this project

README

          

Thorium

Thorium is a statically-typed functional programming language that compiles to Lisp-inspired human-readable bytecode and runs on a custom VM called element90.

It is designed to be simple, inspectable, and educational, while still supporting advanced features like:



  • Immutable and mutable variables (@mut)

  • Lists and arrays

  • Structs and first-class functions

  • External functions and built-in standard library functions

  • Debug metadata for runtime inspection

Distribution

Thorium ships as a ZIP file containing:


element90 # Thorium VM executable
thbc # Thorium Bytecode Compiler executable
core/ # Standard library modules
src/ # Source code for element90 and thbc



  • element90: runs compiled .thprg programs.


  • thbc: compiles .th source code to .thb (human-readable bytecode) or .thprg (compiled program).


  • core/: standard library modules for Thorium programs.

File Types

ExtensionDescription

.thThorium source code (human-editable)
.thbHuman-readable bytecode (intermediate representation)
.thprgCompiled program suitable for element90

Quick Start


  1. Write a Thorium program (demo.th):

    @module demo
    
    @use core.io

    int numbers = [1 : 2 : 3 : 4 : 5]

    function sum_list : nums int[] : int =
    int total
    total = 0
    for n in nums do
    total = total + n
    ret total

    io.print : sum_list : numbers


  2. Compile the program:

    ./thbc demo.th

    This generates demo.thb (inspectable bytecode) and demo.thprg (compiled program).


  3. Run the compiled program:

    ./element90 demo.thprg


Features


  • Statically typed functional language

  • First-class functions

  • Structs

  • Lists and for loops

  • External functions for integration with other code

  • Built-in debugging support

Use Cases

Thorium is ideal for:



  • Learning how a programming language VM works

  • Exploring functional programming concepts

  • Building small educational projects with a minimal runtime

  • Embedding the VM and program into freestanding executables for distribution