Jump to content

Kawa (Scheme implementation)

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by René Vincent Jansen (talk | contribs) at 19:45, 4 September 2012 (corrected erroneous specification of java class invocation: does not need the .class extension). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Kawa
Developer(s)Per Bothner
Stable release
1.12 / May 10, 2012 (2012-05-10)
Repository
Written inScheme / Java
Operating systemCross-platform
PlatformJava Virtual Machine
TypeScheme programming language interpreter/compiler
LicenseMIT License
Websitehttp://www.gnu.org/software/kawa/

Kawa is a language framework written in Java that implements the programming language Scheme, and can be used to implement other languages. It is a part of the GNU Project.

The name "Kawa" comes from the Polish word for coffee – a play on words, since Java is another familiar name for coffee.

Integration with Java

Besides using the Scheme programming language, you can access Java object fields and methods, using code like this:

(invoke object 'method argument ...)

This will invoke a Java method, and does the same thing as object.method(argument, ...) in Java.

You can access an object's fields with:

object:field-name

or

(invoke object 'field)

You can also invoke static (class) methods with the function "invoke-static".

You can extend Kawa with Java code (creating scheme functions in Java), as well as combine Kawa with other JVM implementations.

How to use

To run Kawa on GNU/Linux:

export CLASSPATH=$CLASSPATH:/path/to/kawa/kawa-1.10.jar
java kawa.repl

To compile a Scheme file to a class file, use the -C parameter:

java kawa.repl --main -C file.scm

This will produce "file.class", which you can run by typing "java file". You can also create an applet or servlet (to compile a servlet you must also put "servlet-xxx.jar" in the CLASSPATH variable).

See also

External links