Icon interpreter in JavaThis project contains an implementation of an interpreter for a small part of the Icon programming language and is the code product of a student project at the IT University of Copenhagen. The interpreter is written in Java 5.0 and may be studied and used in any way compliant with the GPL. The authors of the project suspects this may be of interest to other students interested in the implementation of programming languages.
Icon constructsThe implementation is focused on a specific method of modeling evaluation of a goal-directed language and thus only aims to support an illustrative amount of types and language constructs. Only the integer type is supported. This table shows how much of Icon is implemented in this version of the program:
+ - Binary arithmetic operators. - Unary operator. < = Binary (in)equality operators. | & ; Connectives. to Integer generator (without step).
About the implementationThe implementation is essentially a realization of the method illustrated in “Denotational semantics of a goal-directed language” (Gudeman, D.A, 1999, ACM Transactions on Programming Languages and Systems 14(1), 107–125).
The interpreter makes use of the explicit representation of several continuations to model the backtracking and goal-directed evaluation which is the most interesting feature of the Icon programming language.
As part of the distributed code a parser implemented in Coco/R serves to map the concrete syntax of Icon to the abstract syntax encoded in the supplied Java classes.
Build in an object-oriented style, this implementation may, with relative little effort, be extended to support a wider range of Icon features and constructs.
Anyone interested in Icon in Java should checkout Jcon, a complete Java-implementation of Icon.
Getting startedAs mentioned this will only be of interest to people who want to study the code. This is not user software.
To check out the code with subversion and build it with ant; open your terminal or prompt and paste the following:
svn checkout http://iconinterpreter.googlecode.com/svn/trunk/ iconinterpreter
antTo run the interpreter write:
java -cp out iconinterpreter/Icon
These details are provided for information only. No information here is legal advice and should not be used as such.