A programming language where computation and types are built from the same mechanism: term unification.
Stellogen is a research language exploring what programming looks like without primitive types or fixed logical rules, just elementary interactive building blocks based on term unification.
Status: Experimental proof of concept / Research project / Esoteric language (not production-ready)
Traditional typed languages use types to constrain programs and ensure correctness. Types act as questions, programs as answers. This is powerful but also constraining, it defines which questions you can even ask.
Stellogen explores a different path:
- Computation and typing use the same mechanism (term unification)
- No primitive types or fixed logic imposed from above
- The compiler only checks that blocks connect: semantic power belongs to you
This shifts responsibility from the language designer to the user. With that power comes the need for discipline, but also the freedom to explore computational models that don't fit traditional type systems.
Stellogen draws inspiration from:
- Prolog/Datalog - Unification and logic programming
- Smalltalk - Minimalism and message-passing
- Rocq (Coq) - Proof-as-program paradigm
- Scheme/Racket - Metaprogramming philosophy
- Shen - Optional type systems and user responsibility
- Girard's Transcendental Syntax - Theoretical foundation
- No primitive types - Types are user-defined as sets of interactive tests
- Unification everywhere - The same mechanism handles both computation and type checking
- Logic-agnostic - Build your own logic rather than conforming to one imposed by the language
- Multi-paradigm - Express logic programming, functional, imperative, or OO styles using the same underlying mechanism
Stellogen's constellation-based model supports multiple programming paradigms:
Paradigm | Stellogen Equivalent |
---|---|
Logic | Constellations (elementary blocks) |
Functional | Layered constellations enforcing order of interaction |
Imperative | Iterative recipes for building constellations |
Object-oriented | Structured constellations |
' Define variable x as positive first-order term +f(a)
(:= x (+f a))
' Define variable y as block of terms containing +f(X) and X
(:= y [(-f X) X])
' Display [(-f X) X] on screen
(show #y)
' Make x and y interact along (+f a) and (-f X)
' The conflict is resolved and propagated to the other term X
' It results in [a]
(:= result (exec #x @#y))
' Display result [a] on screen
(show #result)
Option A: Download Binary (fastest)
- Get the latest release from Releases
then put the executable in your PATH as
sgen
.
Option B: Install via opam (up-to-date and more convenient)
opam pin stellogen https://github.com/engboris/stellogen.git
# The command sgen is directly accessible from your PATH
Option C: Build from Source
# Install dependencies
opam install . --deps-only --with-test
# Build
dune build
# Executable will be in _build/default/bin/
# You can put it in your PATH for more convenience
Option D: Build with Nix
nix develop
dune build
Assuming the executable is named sgen
and that it is in your PATH:
sgen run examples/hello.sg
- Quick tutorial: https://github.com/engboris/stellogen/wiki/Basics-of-Stellogen
- Examples: Explore
examples/
directory
Stellogen provides three main commands:
Run a Stellogen program:
sgen run <filename>
Example:
sgen run examples/hello.sg
9305
pre>
Show how macros expand and code is preprocessed:
sgen preprocess <filename>
Useful for debugging macro expansions and understanding how syntactic sugar is desugared.
Automatically re-run your program when the file changes (great for development):
sgen.exe watch <filename>
sgen.exe watch --timeout=5 <filename> # Custom timeout in seconds
Example workflow:
# In one terminal
sgen watch myprogram.sg
# Edit myprogram.sg in your editor, it auto-reruns on save!
For detailed command information:
sgen --help
sgen run --help
sgen preprocess --help
sgen watch --help
Ready to explore? Dive into the Quick Tutorial!