TyRuBa is a logic-meta-programming system which was designed to be
used for generating Java code. It was implemented as part of
my
Ph.D. work as a system to experiment with the idea of
type-oriented logic meta programming. TyRuBa's name derives from this
origin, it is an acronym for 'Type Rule Base'.
However, the system has no specific built-in features which make it
focus on types. Rather it is a general, simple logic programming
language with a few peculiarities to facilitate the manipulation of
Java code for the purpose of code generation.
TyRuBa Generation 2 (versions 6.x and beyond): major changes
since version 5.x
The TyRuBa logic programming language has undergone major changes
since its last publicly released version. Changes to the language are
of the extent that for a brief time I considered changing TyRuBa's
name. In some sense it is not the same language anymore and it is
unfortunatley not backward compatible. I think that most code however
can be ported relatively easily to the new version if it did not rely
extensively on some of the higher order programming features. The
higher order programming features are no longer supported in the new
language. They are useful at times, but were sacrificed for the sake of
efficiency and to simplify the implementation of more advanced type and
mode checking which are described in some detail in the revised tutorial.
New features in TyRuBa 6.x versions:
A Type and Mode checking system. This offers better (though still
rather cryptic at times :-) error messages as well as more intelligence
on behalf of the query engine in "making" queries work by rearranging
the order of expressions. Thus the language has become significantly
more declarative. In general, writing rules has become a bit harder now
because you have to satisfy the type system, which is a little picky
sometimes, but writing queries on the other hand has become
signficantly easier because of the engines understanding of proper
execution modes for predicates. The Type and Mode system should be
considered as experimental at this stage and likely to undergo changes.
You can actually have an impact on what changes by informing is where
the type system makes it hard / impossible to port existing 5.x code.
A factbase which stores facts and indexes for lookup partially on
disk. This allows for much larger factbases to be used without running
out of memory.
Together with the disk-based factbase comes the ability to
persist a factbase between runs of the engine (only accessible through
use of the API interfaces, not through the commandline application)
Good old TyRuBa 5.x features retained in 6.x
Most of the existing library predicates from version 5.x have
been ported. For end-users writing queries, for example in the JQuery tool the difference will
harldy be noticed (except that there are more interesting error
messages and the query engine now is not so picky about the order in
which expressions occur in a query anymore).
TyRuBa does 'tabling' of query results. Tabling is a kind of
caching, which stores results of previously run queries. It does so in
a way which helps detect certain forms of recursive dependencies which
would make ordinary Prolog go into infinite loops.
TyRuBa has a special term syntax which can be used to represent
code/string templates. This is a primitive but effective mechanism to
generate/assemble code from logic descriptions. The mechanism under 6.x
has not been used or tested much and there are some portential
complications in using it because the query engine now reorganizes
queries based on modes. Since the codegeneration typically depends on
some "impure" predicates such "write_output" this may cause
complications.
TyRuBa is still 100% pure Java and runs on any machine which
supports Java 1.3.
Feature no longer supported:
TyRuBa 5.x higher order (hilog) logic programming features.
TyNI: TyRuBa 5.x experimental native interface, a mechanism to
call Java methods from within TyRuBa has been dropped. It has
been
replaced with a more efficient internal API for adding native
predicates. If there is a need for people to port some of their
existing native predicates to TyRuBa6.0 please contact me, and we
probably will put some effort into helping you out and making these
API's more accessible and documented for outside use.
Example Code
Most example code has not been ported yet to 6.x versions.
dessing-pattern-example.zip
paper in pdf is included in the package. Also Mac standalone versions
of the GUI and comand-line TyRuBa Java applications. This example has not been converted to the newest
version of tyruba.
COOL (Coordination Aspect Language) This is the example from the
Reflection'99 paper. It implements a simple synchronization language
and uses it to generate synchronization code for a stack class in
several different ways. This is now part of the tyruba distribution
package under examples/cool/
More Reading Material
Some other material available for reading more about TyRuBa:
Aspect-Oriented
Logic Meta Programming a paper which elaborates an example of how
TyRuBa 5.x was used to do Aspect Oriented Programming. We implemented
and extend an aspect language for managing synchronization in Java
programs.