tj/luna logo

tj/luna

Free

luna programming language - a small, elegant VM implemented in C

FreeFree tier
Type
Open Source

About tj/luna

Luna is an expressive, minimalistic, elegant programming language implemented in C. It features cooperative thread concurrency at its core, async I/O, and draws influences from Lua, io, Rust, Ruby, and C. The language prioritizes unification and minimalism over obscure conveniences, omitting features like getters/setters and method_missing-style delegation. It is statically typed with type inference, and offers method syntactic sugar for readability. Planned capabilities include multiple dispatch (function overloading). Currently, Luna only parses code and builds an AST; it does not yet execute code. The project is archived and read-only as of May 2018, representing an early exploration of VM design.

Key Features

Cooperative thread concurrency
Async I/O support
Statically typed with type inference
Multiple dispatch (planned)
Method syntactic sugar for function invocation
Small codebase (~2000 SLOC)
Embeddable and hackable core
Linenoise integration for REPL
Lexer, parser, and AST implementation

Pros & Cons

Pros
  • Expressive and minimalistic syntax
  • Small and clean codebase for easy understanding
  • Influences from multiple well-designed languages
  • Planned multiple dispatch reduces verbosity
  • Method syntactic sugar improves readability
  • Statically typed with optional type annotations
Cons
  • Archived and no longer maintained
  • Incomplete: only parses code, does not execute
  • No garbage collection, continuations, or optimizations yet
  • Closures and portability not implemented
  • Not production-ready; experimental only

Best For

Learning VM and programming language designExploring concurrency modelsBuilding small, embedded scripting languagesResearch into static typing and inferenceEducational tool for compiler front-end development

FAQ

Is Luna ready for production use?
No. Luna is an archived, read-only project that only parses code and builds an AST. It does not run any code and lacks key features like garbage collection, closures, and execution.
What are the design goals of Luna?
Goals include being fast, small (~2000 SLOC), simple, elegant, easy to learn, statically typed with inference, and offering high concurrency out of the box via coroutines. It is designed to be embeddable and hackable.
What programming languages influenced Luna?
Luna draws influences from Lua, io, Rust, Ruby, and C.
Does Luna support object-oriented features like classes?
No. Luna has no concept of classes, methods, or prototypes. It uses functions and method syntactic sugar to invoke functions as if they were methods.