janet-lang/janet logo

janet-lang/janet

Free

A dynamic language and bytecode vm

FreeFree tier
Type
Open Source

About janet-lang/janet

Janet is a dynamic programming language designed for system scripting, expressive automation, and extending programs written in C or C++ with user scripting capabilities. It strikes a balance between Lua's simplicity and the larger ecosystems of Python and GNU Guile, offering a richer core library than Lua while being smaller and easier to embed than Python or Guile. Key features include a REPL for interactive development, a separate client program for embedding, built-in socket networking, threading, subprocesses, file system functions, a Parsing Expression Grammar (PEG) engine as a robust alternative to regex, macros and compile-time computation, and a per-thread event loop. Janet is free and open-source, with a growing community and available as a library that can be embedded into applications.

Key Features

600+ functions and macros in core library
Built-in socket networking, threading, subprocesses, and file system functions
Parsing Expression Grammars (PEG) engine as a robust alternative to regex
Macros and compile-time computation
Per-thread event loop
Foreign Function Interface (FFI) for calling C libraries
REPL for interactive development
Ability to embed Janet in other programs as a scripting language
Cross-platform support (Windows, Linux, macOS, Plan 9, etc.)

Pros & Cons

Pros
  • Richer core library than Lua, smaller than Python/Guile
  • Easy to embed and port to different platforms
  • Built-in PEG engine for pattern matching
  • Supports macros and compile-time metaprogramming
  • Includes REPL for interactive exploration
  • Free and open-source with permissive license
Cons
  • Smaller ecosystem and fewer third-party libraries than mainstream languages
  • Less community support and fewer learning resources available
  • May have a steeper learning curve for those unfamiliar with functional programming concepts

Best For

System scripting and automationEmbedded scripting for C/C++ applicationsRapid prototyping and experimentationNetwork server development (e.g., TCP echo server)Game scripting and interactive applicationsExtending programs with user-defined logic

FAQ

What is Janet primarily used for?
Janet is designed for system scripting, expressive automation, and extending programs written in C or C++ with user scripting capabilities. It can also be embedded in other applications.
How does Janet compare to Lua?
Janet has more built-in functionality and a richer core language than Lua, while still being lightweight and easy to embed. It includes features like a PEG engine, threading, and an event loop out of the box.
Can I use Janet for network programming?
Yes, Janet includes built-in socket networking and an event loop, making it suitable for building network servers and clients, as demonstrated by the TCP echo server example in the documentation.
Is Janet free and open-source?
Yes, Janet is free and open-source, released under a permissive license. You can download, modify, and distribute it freely.