Janet Language

Janet is a functional and imperative programming language. It runs on Windows, Linux, macOS, and should run on other systems with some porting. The entire language (core library, interpreter, compiler, assembler, PEG) is about 300-500 kB and should run on many constrained systems.

Use Cases

Janet makes a good system scripting language, or a language to embed in other programs. Think Lua or Guile. Janet also can be used for rapid prototying, dynamic systems, and other domains where lisp shines. Implemented in mostly standard C99, janet runs on Windows, Linux and macOS. The few features that are not standard C (dynamic library loading, compiler specific optimizations), are fairly straight forward. Janet can be easily ported to new platforms.

Features

  • Export your projects to standalone executables with a companion build tool, jpm
  • Try It

    >
    (print "hello, world!")

    Usage

    A repl is launched when the binary is invoked with no arguments. Pass the -h flag to display the usage information. Individual scripts can be run with janet myscript.janet

    If you are looking to explore, you can print a list of all available macros, functions, and constants by entering the command all-bindings into the repl.

    $ janet
    Janet 1.0.0-dev-cc1ff91  Copyright (C) 2017-2019 Calvin Rose
    janet:0:> (+ 1 2 3)
    6
    janet:10:> (print "Hello, world!")
    Hello, world!
    nil
    janet:34:> (os/exit)
    $ janet -h
    usage: janet [options] script args...
    Options are:
      -h : Show this help
      -v : Print the version string
      -s : Use raw stdin instead of getline like functionality
      -e code : Execute a string of janet
      -r : Enter the repl after running all scripts
      -p : Keep on executing if there is a top level error (persistent)
      -q : Hide prompt, logo, and repl output (quiet)
      -k : Compile scripts but do not execute
      -m syspath : Set system path for loading global modules
      -c source output : Compile janet source code into an image
      -n : Disable ANSI color output in the repl
      -l path : Execute code in a file before running the main script
      -- : Stop handling options

    Projects using Janet

    Modules and Libraries

    See some auxiliary projects on GitHub. Here is a short list of libraries for Janet to help you get started with some interesting stuff.

    For editor support:

    Discussion

    Feel free to ask questions and join discussion on the Janet Gitter Channel. Alternatively, check out the #janet channel on Freenode