Janet (language)
Janet is a functional and imperative Lisp-dialect programming language and bytecode virtual machine designed to be small, fast, and easily embedded into C applications.
Definition
Janet is a functional and imperative Lisp-dialect programming language and bytecode virtual machine designed to be small, fast, and easily embedded into C applications.
Overview
Janet was created by Calvin Rose and first released in 2018 as a modern, compact Lisp intended for both standalone scripting and embedding inside larger host applications, in the spirit of Lua but with Lisp syntax and semantics. The language ships as a single C library with no external dependencies, so it can be dropped into an existing C or C++ project to add a scripting layer, and its interpreter, compiler, and standard library together compile down to a very small binary, making Janet attractive for resource-constrained or embedded environments. Janet is a Lisp-1 with immutable-by-default core data structures (persistent-style arrays, tables, and structs alongside their mutable counterparts), first-class closures, and macros for compile-time metaprogramming, giving it much of the expressive power associated with Clojure or Scheme in a far smaller footprint. A built-in PEG (Parsing Expression Grammar) library ships with the standard distribution, making Janet a popular choice for writing parsers and small domain-specific languages without external dependencies. Concurrency is handled through lightweight, cooperatively scheduled fibers, which double as Janet's mechanism for generators, coroutines, and structured error handling via try/catch-like constructs built on fiber signals. Janet also includes tooling to compile a Janet program together with the interpreter into a single, self-contained native executable, which appeals to developers who want to distribute command-line tools without requiring users to install a separate runtime. Its combination of a tiny embeddable core, expressive Lisp semantics, and pragmatic standard library (networking, file I/O, JSON, and more included) has made it popular for scripting inside games and applications, for writing CLI utilities, and among developers looking for a Lisp that feels closer to Lua in deployment simplicity than to Common Lisp or Racket.
Key Features
- Small, dependency-free C implementation designed for easy embedding
- Lisp-1 syntax with macros for compile-time metaprogramming
- Immutable and mutable variants of core data structures (arrays, tables, structs)
- Built-in PEG (Parsing Expression Grammar) library for writing parsers
- Lightweight fibers providing coroutines, generators, and structured error handling
- Can compile a script and the interpreter into a single native executable
- Fast startup and low memory overhead compared to larger Lisp implementations
- Batteries-included standard library covering files, networking, and JSON