How to connect Alloy model with JAVA or Python?

656 Views Asked by At

Can somebody help me and may be give some explanation or examples with my problem? Assuming that there are no "numbers" or "integers" (Alloy works with entities), how can I use my model (which I created in Alloy) through JAVA or Python? How to "connect" Alloy's model with other languages?

Thanks! Vadik.

2

There are 2 best solutions below

0
On

Here is an example: http://alloy.mit.edu/alloy/code/EvaluatorExample.java.html.

You have to use Alloy (jar file) as a library in your Java application.

2
On

If you want to pass this model to Python, you would need to create new data types. This can be done with classes.

For example:

class Person:
    def __init__(self, name, age):
        self.name = name
        self.age = age

stephen = Person('Stephen', 27)

There you have a new data type: Person

You would need to create the right classes to represent the same types of your Alloy model.