Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJul 21, 2026·3 min de lecture

Janet — Lightweight Embeddable Programming Language

A functional and imperative Lisp dialect designed for embedding, scripting, system automation, and rapid prototyping with a tiny footprint.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Janet Overview
Commande d'installation directe
npx -y tokrepo@latest install b2d4d7b0-84e1-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

Janet is a small, portable, dynamically typed programming language inspired by Clojure, Lua, and Python. It is designed for embedding into C/C++ applications, writing build scripts, system automation, and rapid prototyping. The entire runtime compiles to a single C file with no external dependencies.

What Janet Does

  • Provides a Lisp-like language with familiar syntax for functional and imperative programming
  • Embeds into C/C++ applications as a single-file library with a clean C API
  • Includes a built-in module system, package manager (jpm), and PEG-based parser combinator
  • Offers fibers and channels for lightweight concurrency without OS threads
  • Compiles scripts to bytecode for faster loading and optional ahead-of-time compilation

Architecture Overview

Janet compiles source code into bytecode that runs on a custom register-based virtual machine written in ANSI C. The runtime includes a mark-and-sweep garbage collector, a module loader, and an event loop for asynchronous I/O. The entire core is a single C file (~15K lines) with no dependencies beyond libc, making cross-compilation and embedding straightforward.

Self-Hosting & Configuration

  • Install via Homebrew, package managers, or compile from source with make && sudo make install
  • Use jpm (Janet Project Manager) to manage dependencies and build projects
  • Embed by including janet.c and janet.h in your C project — no separate library needed
  • Configure the module search path via JANET_PATH environment variable
  • Pre-compile scripts to images with janet -c script.janet script.jimage for faster startup

Key Features

  • Tiny runtime (~300 KB binary) suitable for resource-constrained environments
  • PEG module for parsing grammars directly in Janet without external parser generators
  • First-class fibers enabling cooperative multitasking and coroutine-based workflows
  • Built-in networking, file I/O, and OS interaction for system scripting
  • Comprehensive standard library covering data structures, regex, JSON, and more

Comparison with Similar Tools

  • Lua — Similar embedding niche; Janet offers richer data structures and a more modern standard library
  • Guile/Scheme — More traditional Lisp; Janet is smaller and simpler to embed
  • Python — Larger ecosystem; Janet is 100x smaller for embedding use cases
  • Fennel — Lisp that transpiles to Lua; Janet has its own VM and does not depend on Lua

FAQ

Q: Is Janet a Lisp? A: Janet is Lisp-inspired with s-expression syntax but adds features from Clojure and Python. It uses brackets for arrays and braces for tables.

Q: How do I add packages? A: Use jpm install package-name. Packages are listed in the Janet package index.

Q: Can Janet replace Lua for game scripting? A: Yes. Janet's embedding API is similar to Lua's, and several game projects use Janet for scripting.

Q: What platforms does Janet support? A: Janet runs on Linux, macOS, Windows, BSDs, and has been ported to embedded systems and WebAssembly.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires