[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The easiest way to start up Kawa is to run the `kawa' program.
This finds your java interpreter, and sets up `CLASSPATH' correctly.
If you have installed Kawa such $PREFIX/bin
is in your $PATH
,
just do:
kawa |
To run Kawa manually, you must start a Java interpreter.
How you do this depends on the Java interpreter.
For JavaSoft's JDK, you must have the Java interpreter
in your PATH
.
You must also make sure that the kawa/repl.class
file,
the rest of the Kawa packages, and the standard Java
packages can be found by searching CLASSPATH.
See section 3.1 Getting and running Java.
Then you do:
java kawa.repl |
In either case, you will then get the `#|kawa:1|#' prompt, which means you are in the Kawa read-eval-print-loop. If you type a Scheme expression, Kawa will evaluate it. Kawa will then print the result (if there is a non-"void" result).
4.1 Command-line arguments 4.2 Running a Command Interpreter in a new Window 4.3 Exiting Kawa
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
You can pass various flags to Kawa, for example:
kawa -e '(display (+ 12 4))(newline)' |
java kawa.repl -e '(display (+ 12 4))(newline)' |
At startup, Kawa executes an init file from the user's home
directory.
The init file is named .kawarc.scm
on Unix-like systems
(those for which the file separator is '/'
),
and kawarc.scm
on other systems.
This is done before the read-eval-print loop
or before the first -f
or -c
argument. (It is not run
for a -e
command, to allow you to set options to override
the defaults.)
~/.kawarc.scm
init file to be run.
~/.kawarc.scm
init file to be run.
-e (scheme-window #t)
.
You can specify multiple `-w' options, and also use `-s'.
The following options control which calling conventions are used:
The default is currently --no-full-tailcalls
because I believe it is
faster (though I have not done any measurements yet).
It is also closer to the Java call model, so may be better for people
primarily interested in using Kawa for scripting Java systems.
Both calling conventions can co-exist: Code compiled
with --full-tailcalls
can call code compiled
with --no-full-tailcalls
and vice versa.
The options `-C', `-d', `-T', `-P', `--main'
`--applet', and --servlet
are used to compile a Scheme file;
see 6.2 Compiling Scheme to a set of .class files.
The option `--connect portnum' is only used by
the `kawa' front-end program.
The following options are useful if you want to debug or understand how Kawa works.
Expression
data structure. This option causes that data structure to be written out
in a readable format to the standard output.
Expression
after
various transformations and optimizations have been done, and just before
code generation.
If there are further command-line arguments after the options have been processed, then the first remaining argument names a file that is read and evaluated. If there is no such argument, then Kawa enters an interactive read-eval-print loop, but only if none of the `-c', `-e', `-f', `-s', `-C', or `--' options were specified.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
An alternative interface runs the Java read-eval-print-loop inside a new window. This is in some ways nicer. One reason is that it provides better editing. You can also create new windows. They can either have different top-level environments or they can share environments. To try it, do:
java kawa.repl -w |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To close a read-eval-print-loop, you can type the special
literal #!eof
at top level. This is recognized as end-of-file.
Unfortunately, due to thread-related complications, just typing
an end-of-file character (normally ctrl/D until Unix), will not work.
If the read-eval-print-loop is in a new window, you can select `Close' from the `File' menu.
To exit the entire Kawa session, call the
exit
procedure (with 0 or 1 integer arguments).
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |