如何在 Promela 中创建二维数组?

How to create two dimensional array in Promela?

要在 C 中创建矩阵,我们需要编写:

int[][] a = {{1,2,3},{1,2,3},{1,2,3}}

如何在 Promela 中创建矩阵?

来自docs

Multidimensional arrays can be constructed indirectly with the use of typedef definitions.

也来自 docs:

EXAMPLES

The first example shows how to declare a two-dimensional array of elements of type byte with a typedef.

typedef array { /* typedefs must be global */
    byte aa[4]
};
init {
    array a[8];   /* 8x4 = 32 bytes total */
    a[3].aa[1] = 5
}

更好的方法是使用