Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

About Promela Language SPIN How I can fix these error spin: model.pml: 8 , Error: syntax error saw ' an identifier' near 'person' spin: model.pml:

About Promela Language SPIN
How I can fix these error
spin: model.pml:8, Error: syntax error saw 'an identifier' near 'person'
spin: model.pml:12, Error: syntax error saw 'an identifier' near 'person'
spin: model.pml:26, Error: no field 'changed' defined in structure 'persons'
saw 'operator: ='
spin: model.pml:28, Error: no field 'd' defined in structure 'persons'
saw '->' near 'persons'
spin: model.pml:28, Error: no field 'd' defined in structure 'persons'
saw 'operator: ='
spin: model.pml:28, Error: no field 'changed' defined in structure 'persons'
saw 'operator: ='
spin: model.pml:31, Error: syntax error saw 'inline name'
spin: model.pml:33, Error: undeclared variable: new_d saw 'operator: !='
Programming
#define P 3// number of people
typedef struct {
int a; // availability interval
int b; // initial offset
int d; // candidate date
bool changed; // flag to indicate if di was updated
} person;
chan to[P]=[1] of { int };
person persons[P];
bool terminated[P]; // array to track termination status
inline f(i, t){
if
:: (t < persons[i].b)-> return persons[i].b;
:: else -> return ((t - persons[i].b + persons[i].a)/ persons[i].a)* persons[i].a + persons[i].b;
fi;
}
proctype Person(byte i){
int t;
do
:: to[i]? t ->
persons[i].changed = false;
if
:: t > persons[i].d -> persons[i].d = t; persons[i].changed = true;
:: else -> skip;
fi;
int new_d = f(i, persons[i].d);
if
:: new_d != persons[i].d -> persons[i].d = new_d; persons[i].changed = true;
:: else -> skip;
fi;
to[(i +1)% P]! persons[i].d;
terminated[i]=!persons[i].changed;
if
:: terminated[0] && terminated[1] && terminated[2]-> break;
:: else -> skip;
fi;
od;
}
init {
atomic {
// initialize persons with a1=5, a2=6, a3=7
persons[0].a =5; persons[1].a =6; persons[2].a =7;
// unknown initial offsets, b1, b2, b3
persons[0].b =0; persons[1].b =0; persons[2].b =0; // these will vary
// initial candidate dates
persons[0].d =0; persons[1].d =0; persons[2].d =0;
// start the processes
run Person(0);
run Person(1);
run Person(2);
// initiate communication
to[0]!0;
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions