Junicon is a Java-based interpreter for the Unicon programming language. Unicon in turn is a unique object-oriented dynamic language descended from Icon that supports goal-directed evaluation of generator expressions. Junicon's novel implementation uses program transformation to translate Unicon into another scripting language, Groovy, that runs under Java. The result is a transformational interpreter for goal-directed evaluation that, because it runs on Java, is portable and has access to the full range of Java facilities for concurrency and graphics.

A key feature of Junicon is its seamless integration with Java, which allows Java methods, class fields, and data types to be accessed from Unicon, and vice-versa. Junicon can function either as an interactive line-by-line interpreter, or as a tool that can translate its input to Java for compilation.

Goal-directed evaluation

The key idea of goal-directed evaluation is that every expression is a generator that produces a sequence of values or fails, and function application searches to find successful results over the cross-product of its operands. For example, a simple expression such as

		f((1 to 3) > 1)
really means
		for i in (1 to 3) { if i > 1 then f(i) else fail }
At each iteration the expression finds the next successful result, and so produces the sequence
		f(2), f(3)
In general,
		f(e,e') = filter(succeed(concat(map(f, e x e'))))
		where f(*,fail)=fail and f(fail,*)=fail
Unicon thus combines the power of generators with Prolog-like backtracking search through a product space, in a very compact notation.