Jcon (pronounced JAY-konn) is a Java-based implementation of the Icon programming language (Griswold and Griswold, 1996). The Jcon translator, written in Icon, generates Java class files that execute in conjunction with a run-time system written in Java. Jcon runs on Unix systems.
Jcon is an essentially complete implementation of Icon,
omitting only a few things such as chdir()
that cannot be done in Java.
Co-expressions, large integers, and pipes are provided,
and a preprocessor is included. String invocation is supported.
Tracing, error recovery, and debugging functions are all included,
although for performance reasons they are disabled by default.
There are a few minor deficiencies due to Java limitations.
Jcon includes almost all of Icon's standard graphics facilities. A few features such as textured drawing and mutable colors are lacking. Details are provided in the Graphics section.
The jcont
script functions similarly to icont
.
The end result of compilation is an executable file, which is produced
by embedding a Zip archive of Java classes (a "Jar file")
inside a shell script.
Separate compilation is also supported, with .zip
files
substituting for .u1/.u2
file pairs.
There is also a jcon
command that is analogous to the
standard icon
command.
Line counts were accurate as of 1999 but have not been updated.
The Jcon translator is a 10,000-line Icon program that produces
either Java class files or ucode (.u1/.u2
) files.
This is somewhat smaller than the 13,000 lines of C code that
form the translator in Version 9 of Icon, but the two totals are not
directly comparable because the two programs have different capabilities.
The common function of generating ucode files from Icon source code
accounts for about 3,500 lines in Jcon and about 9,000 lines in Version 9.
The Jcon runtime system comprises 18,000 lines of Java code. The corresponding portion of Version 9, counting only the Unix code, is over 50,000 lines of C code.
The jcont
script that directs compilation and linking
is a 400-line shell script.
While this works well for Unix, it is the single largest impediment
to a non-Unix port.
We believe that writing a replacement program would be the easiest route
to a Windows or Macintosh port.
Jcon includes an automated test suite containing 8,000 lines of Icon programs. These are drawn from the standard Icon test suite, other existing Icon programs, and 3,000 lines of new tests. Jcon also includes additional manually-run graphics tests and a small collection of graphics demonstration programs.
Denise Todd contributed to the Jcon translator. Bob Alexander wrote the preprocessor. Ralph Griswold offered useful advice and helped test early versions. Some small portions of the runtime system are derived from Version 9 of Icon. The GIF encoder is from Jef Poskanzer (www.acme.com).