MinervaToJava

The use of metagen to automatically generate a MINERVA package from an existing Java class.

The example shows how to build a program "random.min" that provides one predicate for every constructor and method of defined by the Java class java.util.Random .

Note that metagen works for any class available at compile time.

To see it in action, use Go.* and Compile.* of this directory.

Here are the sources:

use_random.min

:- package(random).

main(_Args) :- random_create(RandomSequence), for(1,I,20), random_nextInt_1(RandomSequence,100,Random), write(Random),write(' '),flush_output, I = 20, nl,flush_output.

Compile.sh

#!/bin/sh
echo -n ':- ' > random.min
minerva -l $MINERVA_HOME/extender/metagen java.util.Random >> random.min
minervac random
minervac use_random

Go.sh

#!/bin/sh
minerva -l use_random

Please note that the class Random used in this example is not supported in current versions of Microsoft Java environments. Use some other class.


Up read on...