Pools; Unification

Soren Renner — 2000-09-09 18:34:46

MORE ABOUT TOY

It is called "Toy" instead of Joy to avoid making a claim of exact adherence to the Joy standard if there is one. It is written in Oberon.

The parser recognizes integers, operators, booleans, strings, single characters, and quotations. It keeps operator definitions in a dictionary which uses a hash table. New operators can be defined as described in a previous post.

The garbage pools have been implemented. The only objection to them -- that garbage of one type couldn't be recycled into a different type -- is weak, because the pools themselves can be exposed to Oberon's GC just by setting pool := NIL, after which a collection can be forced with System.Collect. The pools are needed, too, because without them [ 1 [1 plus] 10000000 times] leaves ten million boxes of garbage each containing the integer 1. With the pools, only one box is left in the pool (because "plus" always tosses one box). Incidentally, this takes about 4 seconds on my 400 mhz x86 box running NO System 3 -- about 2.5 million additions per second. How does this compare with the Joy-in-C machines?

I am thinking that it would be diverting to use a dictionary to implement logical variables. Then Prolog could be implemented in Joy. Maybe a unification operator is all that would be required. Actually I was thinking more of Mozart Oz than Prolog. All the state would be carried around explicitly in a list.