k-legacy
k-legacy copied to clipboard
Swap
Hi,
I'd like to implement some kind of swap function. But I'm unable to specify multiple conditions in one cell. Is that possible. In case it is, how?
Currently I tried the following ways.
This way is not accepted by the kompile parser ("Inner Parser: Parse error: unexpected character 'X'.").
rule <k> swap(X1:Id, X2:Id) => . ...</k>
<env>... X1 |-> L1 ... X2 |-> L2 ...</env>
<store> ... L1 |-> (V1 => V2) ... L2 |-> (V2 => V1) </store>
This way compiles but crashes krun ("A fatal error has been detected by the Java Runtime Environment: # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007fec43a7ba2, pid=9624, tid=0x0000000000003280"):
rule <k> swap(X1:Id, X2:Id) => . ...</k>
<env>... X1 |-> L1 X2 |-> L2 ...</env>
<store> ... L1 |-> (V1 => V2) L2 |-> (V2 => V1) </store>
Thank you for any hints.
Have you tried on https://github.com/kframework/k5? This version of K is deprecated.