0

I am generating a Message Sequence Chart (MSC) to my model. I have the following code in the transition and it is working:

input (p_id, p_cert, v_id, v_cert);
action
MSC.addEvent(msc, p, i, func_to_concat(p_id, p_cert));
if v_cred(p_id, p_cert, v_id, v_cert) then
   MSC.addEvent(msc, i, p, "Some message here.")
else
   MSC.addEvent(msc, i, p, "Some other message.")

I tested this code and it worked fine. Then, I decided to put it into a function, that is coded as follows:

fun a(msc, e, i, id, cert, v_id, v_cert) =
    MSC.addEvent(msc, i, e, func_to_concat(id, cert));
    if v_cred(id, cert, v_id, v_cert) then
       MSC.addEvent(msc, i, e, "Some message here.")
    else
       MSC.addEvent(msc, i, e, "Some other message.")

But I am receiving this error message:

Error: Error: exception Compile is raised with Aborted parsing

Can anyone suggest something to solve this problem?

4

1 回答 1

0

问题解决了。为了在 ML 语言中指定命令块,我们必须将代码放在括号内:

fun a(msc, e, i, id, cert, v_id, v_cert) = (
    MSC.addEvent(msc, e, i, func_to_concat(id, cert));
    if v_cred(id, cert, v_id, v_cert) then
       MSC.addEvent(msc, i, e, "Some message here.")
    else
       MSC.addEvent(msc, i, e, "Some other message.")
)
于 2018-12-07T21:46:39.450 回答