Junicon Quick Reference Card

Orielle, LLC
www.orielle.com

University of Idaho
www.cs.uidaho.edu

  Introduction

Junicon is a Java-based interpreter for the Unicon programming language, implemented using program transformation. Unicon in turn is a unique object-oriented scripting language that supports goal-directed evaluation of generator expressions. Junicon's novel implementation uses XML-based 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 support for concurrency and graphics.

A key feature of Junicon is its seamless interoperability with Java, which allows Java methods, class fields, and data types to be accessed from Unicon, and vice-versa. Junicon can function in several modes, either as an interactive line-by-line interpreter, or as a tool that can translate its input into Groovy or directly to Java for later compilation. When run interactively, Java methods can be used transparently. When compiling to Java, however, casts may be needed, and Java method invocation must be indicated using "::" to distinguish it from the lambda expression invocation used by Junicon methods.

Junicon also supports multi-language embedding using scoped annotations. Junicon classes, methods, and expressions can be embedded in Java or Groovy, and vice-versa, using annotations of the form @<script lang="junicon"> code @</script> (or "java" or "groovy", respectively). Scoped annotations can be nested, in which case the code is transformed and then embedded from the innermost to the outermost annotation. Goal-directed evaluation can thus be embedded into Java or Groovy in a familiar and minimally invasive manner. Similarly, Java code can be injected into Junicon for native evaluation.

Junicon has a small number of additional constructs that extend Unicon syntax with new features. These extensions are conservative in that they preserve the original Unicon syntax. The new features of Junicon include scoped annotations for expressions, integration with the Java package model, familiar block notation for classes and methods, support for multi-language embedding, and supplemental features such as generator expressions as first class citizens, map and set literals, lambda expressions, concurrent generators using a lazy proxy for a thread, and function invocation without parenthesis.

Junicon has a small number of differences from Unicon that are required to cleanly interface with Java and Groovy.

Below is a summary of Junicon's extensions to Unicon.

  Extensions to Unicon

Annotations and directives

Java integration

Multi-language embedding

Supplemental features

  Discussion

The new features of Junicon include: