1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-27 00:40:26 +00:00
janet/janet.1

234 lines
6.1 KiB
Groff
Raw Normal View History

2018-11-18 14:35:41 +00:00
.TH JANET 1
.SH NAME
2019-01-21 21:04:47 +00:00
janet \- run the Janet language abstract machine
2018-11-18 14:35:41 +00:00
.SH SYNOPSIS
.B janet
[\fB\-hvsrpnqk\fR]
2019-02-18 20:23:59 +00:00
[\fB\-e\fR \fISOURCE\fR]
[\fB\-l\fR \fIMODULE\fR]
[\fB\-m\fR \fIPATH\fR]
[\fB\-c\fR \fIMODULE JIMAGE\fR]
2018-11-18 14:35:41 +00:00
[\fB\-\-\fR]
2020-01-20 23:29:29 +00:00
.BR script
.BR args ...
2018-11-18 14:35:41 +00:00
.SH DESCRIPTION
Janet is a functional and imperative programming language and bytecode interpreter.
It is a Lisp-like language, but lists are replaced by other data structures
(arrays, tables, structs, tuples). The language also features bridging
2018-11-18 14:35:41 +00:00
to native code written in C, meta-programming with macros, and bytecode assembly.
There is a repl for trying out the language, as well as the ability to run script files.
2019-01-21 21:04:47 +00:00
This client program is separate from the core runtime, so Janet could be embedded
2019-02-18 20:23:59 +00:00
into other programs. Try Janet in your browser at https://janet-lang.org.
2018-11-18 14:35:41 +00:00
2019-01-21 21:04:47 +00:00
Implemented in mostly standard C99, Janet runs on Windows, Linux and macOS.
2018-11-18 14:35:41 +00:00
The few features that are not standard C99 (dynamic library loading, compiler
specific optimizations), are fairly straight forward. Janet can be easily ported to
2018-11-18 14:35:41 +00:00
most new platforms.
2020-01-20 23:29:29 +00:00
.SH REPL KEY-BINDINGS
.TP 16
.BR Home
Move cursor to the beginning of input line.
2020-01-20 23:29:29 +00:00
.TP 16
.BR End
Move cursor to the end of input line.
2020-01-20 23:29:29 +00:00
.TP 16
.BR Left/Right
Move cursor in input line.
2020-01-20 23:29:29 +00:00
.TP 16
.BR Up/Down
Go backwards and forwards through history.
.TP 16
.BR Tab
Complete current symbol, or show available completions.
2020-01-20 23:29:29 +00:00
.TP 16
.BR Delete
Delete one character after the cursor.
2020-01-20 23:29:29 +00:00
.TP 16
.BR Backspace
Delete one character before the cursor.
.TP 16
.BR Ctrl\-A
Move cursor to the beginning of input line.
.TP 16
.BR Ctrl\-B
Move cursor one character to the left.
.TP 16
.BR Ctrl\-D
If on a newline, indicate end of stream and exit the repl.
.TP 16
.BR Ctrl\-E
Move cursor to the end of input line.
.TP 16
.BR Ctrl\-F
Move cursor one character to the right.
2020-01-20 23:29:29 +00:00
.TP 16
.BR Ctrl\-H
Delete one character before the cursor.
.TP 16
.BR Ctrl\-K
Delete everything after the cursor on the input line.
2020-01-20 23:29:29 +00:00
.TP 16
.BR Ctrl\-L
Clear the screen.
.TP 16
.BR Ctrl\-N/Ctrl\-P
Go forwards and backwards through history.
2020-01-20 23:29:29 +00:00
.TP 16
.BR Ctrl\-U
Delete everything before the cursor on the input line.
2020-01-20 23:29:29 +00:00
.TP 16
.BR Ctrl\-W
Delete one word before the cursor.
2020-01-20 23:29:29 +00:00
.TP 16
.BR Ctrl\-G
Show documentation for the current symbol under the cursor.
.TP 16
.BR Ctrl\-Q
Clear the current command, including already typed lines.
2020-01-20 23:29:29 +00:00
.TP 16
.BR Alt\-B/Alt\-F
Move cursor backwards and forwards one word.
2020-01-20 23:29:29 +00:00
.TP 16
.BR Alt\-D
Delete one word after the cursor.
2020-01-20 23:29:29 +00:00
.TP 16
.BR Alt\-,
Go to earliest item in history.
2020-01-20 23:29:29 +00:00
.TP 16
.BR Alt\-.
Go to last item in history.
2020-01-20 23:29:29 +00:00
.LP
The repl keybindings are loosely based on a subset of GNU readline, although
Janet does not use GNU readline internally for the repl. It is a limited
substitute for GNU readline, and does not handle
utf-8 input or other mutlibyte input well.
To disable the built-in repl input handling, pass the \fB\-s\fR option to Janet, and
use a program like rlwrap with Janet to provide input.
For key bindings that operate on words, a word is considered to be a sequence
of characters that does not contain whitespace.
2018-11-18 14:35:41 +00:00
.SH DOCUMENTATION
For more complete API documentation, run a REPL (Read Eval Print Loop), and use the doc macro to
see documentation on individual bindings.
.SH OPTIONS
.TP
.BR \-h
Shows the usage text and exits immediately.
.TP
.BR \-v
Shows the version text and exits immediately.
.TP
.BR \-s
Read raw input from stdin and forgo prompt history and other readline-like features.
.TP
2019-02-18 20:23:59 +00:00
.BR \-e\ code
Execute a string of Janet source. Source code is executed in the order it is encountered, so earlier
arguments are executed before later ones.
2018-11-18 14:35:41 +00:00
.TP
.BR \-d
Enable debug mode. On all terminating signals as well the debug signal, this will
cause the debugger to come up in the REPL. Same as calling (setdyn :debug true) in a
default repl.
.TP
.BR \-n
Disable ANSI colors in the repl. Has no effect if no repl is run.
2018-11-18 14:35:41 +00:00
.TP
.BR \-r
2019-01-21 21:04:47 +00:00
Open a REPL (Read Eval Print Loop) after executing all sources. By default, if Janet is called with no
2018-11-18 14:35:41 +00:00
arguments, a REPL is opened.
.TP
.BR \-p
2019-01-21 21:04:47 +00:00
Turn on the persistent flag. By default, when Janet is executing commands from a file and encounters an error,
it will immediately exit after printing the error message. In persistent mode, Janet will keep executing commands
2018-11-18 14:35:41 +00:00
after an error. Persistent mode can be good for debugging and testing.
.TP
2019-02-18 20:23:59 +00:00
.BR \-q
2020-04-27 23:57:53 +00:00
Hide the logo in the repl.
2019-02-18 20:23:59 +00:00
.TP
.BR \-k
Don't execute a script, only compile it to check for errors. Useful for linting scripts.
2019-02-18 20:23:59 +00:00
.TP
.BR \-m\ syspath
Set the dynamic binding :syspath to the string syspath so that Janet will load system modules
2019-02-18 20:23:59 +00:00
from a directory different than the default. The default is set when Janet is built, and defaults to
2019-02-18 20:31:15 +00:00
/usr/local/lib/janet on Linux/Posix, and C:/Janet/Library on Windows. This option supersedes JANET_PATH.
2018-11-18 14:35:41 +00:00
2019-01-21 21:04:47 +00:00
.TP
2019-02-18 20:23:59 +00:00
.BR \-c\ source\ output
Precompiles Janet source code into an image, a binary dump that can be efficiently loaded later.
Source should be a path to the Janet module to compile, and output should be the file path of
resulting image. Output should usually end with the .jimage extension.
.TP
2020-07-07 02:24:49 +00:00
.BR \-l\ lib
Import a Janet module before running a script or repl. Multiple files can be loaded
2019-01-21 21:04:47 +00:00
in this manner, and exports from each file will be made available to the script
or repl.
2018-11-18 14:35:41 +00:00
.TP
.BR \-\-
2019-02-18 20:23:59 +00:00
Stop parsing command line arguments. All arguments after this one will be considered file names
and then arguments to the script.
2018-11-18 14:35:41 +00:00
2019-02-18 20:31:15 +00:00
.SH ENVIRONMENT
.B JANET_PATH
.RS
The location to look for Janet libraries. This is the only environment variable Janet needs to
find native and source code modules. If no JANET_PATH is set, Janet will look in
the default location set at compile time.
.RE
.B JANET_HASHSEED
.RS
To disable randomization of Janet's PRF on start up, one can set this variable. This can have the
effect of making programs deterministic that otherwise would depend on the random seed chosen at program start.
This variable does nothing in the default configuration of Janet, as PRF is disabled by default. Also, JANET_REDUCED_OS
cannot be defined for this variable to have an effect.
.RE
2018-11-18 14:35:41 +00:00
.SH AUTHOR
Written by Calvin Rose <calsrose@gmail.com>