1JANET(1)                    General Commands Manual                   JANET(1)
2
3
4

NAME

6       janet - run the Janet language abstract machine
7

SYNOPSIS

9       janet [-hvsrpnqik] [-e SOURCE] [-E SOURCE ...ARGUMENTS] [-l MODULE] [-m
10       PATH] [-c MODULE JIMAGE] [-w LEVEL] [-x LEVEL] [--] script args...
11

DESCRIPTION

13       Janet is a functional and imperative programming language and  bytecode
14       interpreter.   It  is  a  Lisp-like language, but lists are replaced by
15       other data structures (arrays, tables, structs, tuples).  The  language
16       also  features  bridging  to native code written in C, meta-programming
17       with macros, and bytecode assembly.
18
19       There is a repl for trying out the language, as well as the ability  to
20       run  script  files.  This client program is separate from the core run‐
21       time, so Janet could be embedded into other programs. Try Janet in your
22       browser at https://janet-lang.org.
23
24       Implemented  in  mostly  standard C99, Janet runs on Windows, Linux and
25       macOS.  The few features that are not  standard  C99  (dynamic  library
26       loading, compiler specific optimizations), are fairly straight forward.
27       Janet can be easily ported to most new platforms.
28
29

REPL KEY-BINDINGS

31       Home            Move cursor to the beginning of input line.
32
33
34       End             Move cursor to the end of input line.
35
36
37       Left/Right      Move cursor in input line.
38
39
40       Up/Down         Go backwards and forwards through history.
41
42
43       Tab             Complete current symbol, or show available completions.
44
45
46       Delete          Delete one character after the cursor.
47
48
49       Backspace       Delete one character before the cursor.
50
51
52       Ctrl-A          Move cursor to the beginning of input line.
53
54
55       Ctrl-B          Move cursor one character to the left.
56
57
58       Ctrl-D          If on a newline, indicate end of stream  and  exit  the
59                       repl.
60
61
62       Ctrl-E          Move cursor to the end of input line.
63
64
65       Ctrl-F          Move cursor one character to the right.
66
67
68       Ctrl-H          Delete one character before the cursor.
69
70
71       Ctrl-K          Delete everything after the cursor on the input line.
72
73
74       Ctrl-L          Clear the screen.
75
76
77       Ctrl-N/Ctrl-P   Go forwards and backwards through history.
78
79
80       Ctrl-U          Delete everything before the cursor on the input line.
81
82
83       Ctrl-W          Delete one word before the cursor.
84
85
86       Ctrl-G          Show  documentation  for  the  current symbol under the
87                       cursor.
88
89
90       Ctrl-Q          Clear the  current  command,  including  already  typed
91                       lines.
92
93
94       Alt-B/Alt-F     Move cursor backwards and forwards one word.
95
96
97       Alt-D           Delete one word after the cursor.
98
99
100       Alt-,           Go to earliest item in history.
101
102
103       Alt-.           Go to last item in history.
104
105
106       The repl keybindings are loosely based on a subset of GNU readline, al‐
107       though Janet does not use GNU readline internally for the repl. It is a
108       limited substitute for GNU readline, and does not handle utf-8 input or
109       other mutlibyte input well.
110
111       To disable the built-in repl input handling,  pass  the  -s  option  to
112       Janet, and use a program like rlwrap with Janet to provide input.
113
114       For  key  bindings  that operate on words, a word is considered to be a
115       sequence of characters that does not contain whitespace.
116
117

DOCUMENTATION

119       For more complete API documentation, run a REPL (Read Eval Print Loop),
120       and use the doc macro to see documentation on individual bindings.
121
122

OPTIONS

124       -h     Shows the usage text and exits immediately.
125
126
127       -v     Shows the version text and exits immediately.
128
129
130       -s     Read  raw  input  from  stdin and forgo prompt history and other
131              readline-like features.
132
133
134       -e code
135              Execute a string of Janet source. Source code is executed in the
136              order  it  is encountered, so earlier arguments are executed be‐
137              fore later ones.
138
139
140       -E code arguments...
141              Execute a single Janet expression as a Janet  short-fn,  passing
142              the remaining command line arguments to the expression. This al‐
143              lows more concise one-liners with command line arguments.
144
145              Example: janet -E '(print $0)' 12 is equivalent  to  '((short-fn
146              (print  $0))  12)',  which  is  in  turn equivalent to `((fn [k]
147              (print k)) 12)`
148
149              See docs for the `short-fn` function for more details.
150
151
152       -d     Enable debug mode. On all terminating signals as well the  debug
153              signal,  this  will  cause  the debugger to come up in the REPL.
154              Same as calling (setdyn :debug true) in a default repl.
155
156
157       -n     Disable ANSI colors in the repl. Has no effect  if  no  repl  is
158              run.
159
160
161       -N     Enable ANSI colors in the repl. Has no effect if no repl is run.
162
163
164       -r     Open  a REPL (Read Eval Print Loop) after executing all sources.
165              By default, if Janet is called with  no  arguments,  a  REPL  is
166              opened.
167
168
169       -R     If  using  the  REPL,  disable loading the user profile from the
170              JANET_PROFILE environment variable.
171
172
173       -p     Turn on the persistent flag. By default, when Janet is executing
174              commands  from  a  file and encounters an error, it will immedi‐
175              ately exit after printing the error message. In persistent mode,
176              Janet  will  keep  executing commands after an error. Persistent
177              mode can be good for debugging and testing.
178
179
180       -q     Hide the logo in the repl.
181
182
183       -k     Don't execute a script, only compile it  to  check  for  errors.
184              Useful for linting scripts.
185
186
187       -m syspath
188              Set  the  dynamic binding :syspath to the string syspath so that
189              Janet will load system modules from a directory  different  than
190              the  default.  The  default  is set when Janet is built, and de‐
191              faults to /usr/local/lib/janet on Linux/Posix, and  C:/Janet/Li‐
192              brary on Windows. This option supersedes JANET_PATH.
193
194
195       -c source output
196              Precompiles  Janet source code into an image, a binary dump that
197              can be efficiently loaded later.  Source should be a path to the
198              Janet  module  to compile, and output should be the file path of
199              resulting image. Output should usually end with the .jimage  ex‐
200              tension.
201
202
203       -i     When  this  flag  is  passed, a script passed to the interpreter
204              will be treated as a janet image file rather than a janet source
205              file.
206
207
208       -l lib Import  a Janet module before running a script or repl. Multiple
209              files can be loaded in this manner, and exports from  each  file
210              will be made available to the script or repl.
211
212       -w level
213              Set  the  warning  linting  level for Janet.  This linting level
214              should be one of :relaxed, :none, :strict, :normal, or  a  Janet
215              number. Any linting message that is of a greater lint level than
216              this setting will be displayed as a warning, but not stop compi‐
217              lation or execution.
218
219       -x level
220              Set  the  error  linting  level  for  Janet.  This linting level
221              should be one of :relaxed, :none, :strict, :normal, or  a  Janet
222              number. Any linting message that is of a greater lint level will
223              cause a compilation error and stop compilation.
224
225       --     Stop parsing command line arguments. All  arguments  after  this
226              one  will  be  considered  file  names and then arguments to the
227              script.
228
229

ENVIRONMENT

231       JANET_PATH
232              The location to look for Janet libraries. This is the only envi‐
233              ronment variable Janet needs to find native and source code mod‐
234              ules. If no JANET_PATH is set, Janet will look  in  the  default
235              location set at compile time.
236
237       JANET_PROFILE
238              Path to a profile file that the interpreter will load before en‐
239              tering the REPL. This profile file will  not  run  for  scripts,
240              though. This behavior can be disabled with the -R option.
241
242       JANET_HASHSEED
243              To disable randomization of Janet's PRF on start up, one can set
244              this variable. This can have the effect of making  programs  de‐
245              terministic  that otherwise would depend on the random seed cho‐
246              sen at program start.  This variable does nothing in the default
247              configuration  of  Janet,  as  PRF is disabled by default. Also,
248              JANET_REDUCED_OS cannot be defined for this variable to have  an
249              effect.
250
251       NO_COLOR
252              Turn  off  color by default in the repl and in the error handler
253              of scripts. This can be changed at runtime via dynamic  bindings
254              *err-color* and *pretty-format*, or via the command line parame‐
255              ters -n and -N.
256
257

AUTHOR

259       Written by Calvin Rose <calsrose@gmail.com>
260
261
262
263                                                                      JANET(1)
Impressum