We add an Alloy predicate defn to a CompModule using the method addFunc()
in file CompModule.java
. We then use the method CompModule.addCommand()
(the version that takes an ExprVar
as an argument) to add a command that calls the predicate we created within the same CompModule.
For this command, we create an ExprVar
with the same label/name as the predicate and pass it as an argument to the addCommand
method.
We do not encounter any errors when we resolve the CompModule that contains this predicate and command.
However, we encounter an error when we try to execute the command using TranslateAlloyToKodkod.execute_command()
.
When we use an ExprVar
of Type.EMPTY
for the predicate name to addCommand
, and tried executing the command, we get a type error that this error was caused because the type of the variable is Type.EMPTY
(thrown by line 136 of Class Expr).
If we try Type.FORMULA
(and Type.INTANDFORMULA
) for the ExprVar
, we get the following error: Fatal Error: Variable “[pred name]” is not bound to a legal value during translation
.
So, our question is: how can we create an Alloy run command to run a specific Alloy predicate using the existing functions in CompModule
, Command
, Expr
, ExprVar
or any other relevant classes?