UIdaho Computer Science Colloquium


Embedding Goal-Directed Evaluation
through Transformation

Peter Mills
CEO, Orielle, LLC



Date: Monday March 21, 2016
Time: 3:30pm
Room: Janssen Engineering, room 328
   Abstract: Goal-directed evaluation is a paradigm that combines the power of generators with backtracking search. In goal-directed evaluation every expression is a generator that produces a sequence of values or fails, and operations search to find successful results over the product space of their operands. Introduced in the influential dynamic language Icon and later refined in its object-oriented descendent Unicon, goal-directed evaluation is difficult to formalize and implement. In particular grafting goal-directed evaluation onto other languages in a manner that provides seamless interoperability has remained an elusive challenge.

We present a novel approach to embedding goal-directed evaluation into existing object-oriented languages based on program transformation. We first introduce a form of annotations for multi-language integration, called scoped annotations, that allow mixing in functionality at the level of expressions, methods, or classes. Transformations over the annotated regions then unravel the syntax of generator expressions to a conventional form by flattening nested generators and making iteration explicit in order to enable native evaluation. To demonstrate the utility of the approach, we have implemented the transformations for Java as well as its dynamic analogue Groovy, and housed them in an interpretive harness that realizes both an interactive extension of Groovy as well as a translator of embedded goal-directed evaluation into Java.