简体   繁体   English

使用弦合金

[英]Using String Alloy

I have an Alloy module 我有一个合金模块

module WorkPlace

sig String{}

sig person{}

sig Employee extends person{

name :String, boss: Employee,worker: set Employee}

sig Employee1 extends person{

name :String, boss: Employee,worker: set Employee}


fact Employee{

all e1:Employee, e2:Employee| (e1.name = e2 && e2.name = e1) =>e1 = e2}

run{}

when i triad to run this mode it give me this massage : "Syntax error at line 2 column 5: There are 3 possible tokens that can appear here: NAME seq this " 当我三合会运行此模式时,它会给我以下消息:“第2行第5列的语法错误:这里可能出现3个可能的标记:NAME seq this”

I don't know what its mean? 我不知道这是什么意思?

2\\ If I have 2 Alloy models ,each model has same element ie mode1/name, model2/name. 2 \\如果我有2个Alloy模型,则每个模型都具有相同的元素,即mode1 / name,model2 / name。 how can I create a fact or pred which can say mode1/name = model2/name? 如何创建可以说mode1 / name = model2 / name的事实或条件?

regards 问候

  1. As user1513683 already answered: 由于user1513683已回答:

    "String" is a reserved word. “字符串”是保留字。 Use "string" instead (or, better, "Name") 使用“字符串”代替(或者更好的是“名称”)

  2. You can open an existing module from another module, and then in that module you can use all sigs/relations present in any of the two modules. 您可以从另一个模块打开一个现有模块,然后在该模块中使用两个模块中任何一个中存在的所有信号/关系。 For example: 例如:

module 1 (file m1.als): 模块1(文件m1.als):

module m1

sig S1 {}

module 2 (file m2.als): 模块2(文件m2.als):

module m2

open m1

sig S2 {}

run { #S1 = #S2 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM