The Computer Science behind ToonTalk The Computer Science behind
ToonTalk
ToonTalk is an interpreter for a concurrent constraint
programming language. Concurrent constraint programming is a synthesis of concurrent logic
programming and constraint logic programming. (See, for example, href="http://mitpress.mit.edu/book-home.tcl?isbn=0262192977">Saraswat). The class of
languages for which programs are roughly interchangeable with ToonTalk programs include href="http://www.mozart-oz.org/">Oz, E-Lang,
Janus, Flat Guarded Horn Clauses, KL1/KLIC, Flat
Concurrent Prolog, Parlog, and Strand. The syntax of all these languages is textual while
ToonTalk has an action-oriented video game animation syntax. The programming environment
is completely different as well. In ToonTalk, the process of constructing, testing, and
debugging programs closely resembles playing a video game. "From
Prolog and Zelda to ToonTalk" is a paper discussing these ideas in detail.
Pictorial Janus is a visual version of Janus in which
pictures are used for source code and the execution of a program can be seen as an
animation. ToonTalk differs from Pictorial Janus (and all visual programming languages) in
that the source code is animated and concrete as opposed to the static and abstract syntax
of visual programming languages. (See href="ftp://ftp.parc.xerox.com/pub/PictorialJanus">Pictorial Janus ftp site and href="http://jerry.c-lab.de/~wolfgang/PJ/">Paderborn University web page.)
The computational model underlying ToonTalk supports the
dynamic creation and termination of asynchronous processes. First-class send and receive
capabilities provide a means for these processes to communicate and synchronize. All state
is local to processes. There is a close relationship between concurrent object-oriented
programming languages (including actor languages) and ToonTalk. (See ToonTalk
papers.) Here is an
essay about how ToonTalk is concurrent and why it is difficult to extend conventional
languages to be concurrent.
ToonTalk includes a puzzle game that includes a
sequence of over 60 puzzles. The connections to computer programming and computer science
for each puzzle are described here.
One way to understand ToonTalk is that it provides
"concretizations" of computational abstractions. For each computational
abstraction ToonTalk provides a tangible equivalent analog.
Computational Abstraction |
ToonTalk Concretization |
computation |
city |
actor or process or object |
house |
methods |
robots |
method preconditions |
contents of thought bubble |
method actions |
actions taught to robot |
tuples or messages or vectors |
boxes |
comparison tests |
scales |
actor spawning |
loaded trucks |
actor termination |
bombs |
constants |
numbers, text, and pictures |
channel transmit capabilities |
birds |
channel receive capabilities |
nests |
program storage |
notebooks |
Another way to understand the computational
model of ToonTalk is to consider what you can train robots to do:
· size="3">send a message (i.e. tell a constraint)
by giving a box or pad to a bird,
· size="3">spawn a new agent
by dropping a box and a team of robots into a
truck,
· size="3">perform simple primitive operations (e.g. +, -, *)
by dropping a pad on a pad,
· size="3">copy an item
by using a magician's wand,
· size="3">terminate an agent
by setting off a bomb,
· size="3">change the contents of a tuple
by taking out items and placing new ones.