J-INTERCAL Documentation

How does it work? The J-INTERCAL compiler takes an INTERCAL source file and produces a corresponding Java class. However the INTERCAL code isn't directly compiled into native Java bytecode. The compiler outputs code for the Java INTERCAL Virtual Machine (JIVM) which is combined with a runtime stub to create a Java class. When called, the stub code passes the JIVM bytecode to an interpreter located in the J-INTERCAL runtime package. The stub code may be called by directly running the class or by calling a method in that class and passing in IO streams for the INTERCAL program to use. That way, INTERCAL programs can be seamlessly included into legacy Java systems.

Installation

  1. Unzip the distribution archive (preserving subdirectories).
  2. Add the file bin/jintercal.jar to your CLASSPATH or unjar it's contents into any directory in your CLASSPATH. This file contains the compiler and the JIVM runtime engine, you need it for running INTERCAL programs as well as for compiling.
  3. The scripts bin/jick for Unix or bin/jick.bat for Windows systems may be used to run the J-INTERCAL compiler (though if you're a real technomasochist, you will prefer to run the compiler manually). Copy the appropriate script into any directory in your path. On Unix, chmod a+x the script.

Compiling and running programs

The compiler is called intercal.Compiler and can be run directly or using the jick script. The -l option can be used to specify the file to use for automagic inclusing of the system library (defaults to ./syslib.i). For additional options, see jick -?. The J-INTERCAL compiler can take more than one file at once, but to ensure maximum inconvenience error messages don't contain file names.

The compiler will produce one Java class file for every INTERCAL source file. The resulting class has the same name as the input file (without the .i extension) and can be run directly using the java command. Just like the compiler, the compiled class will accept some command line options. Use -? to get a list. After all, compiling and running Louis Howell's prime program provided in the samples directory is as simple as

% cd samples
% jick primes.i
% java primes