Spinroot

A forum for Spin users

You are not logged in.

#1 Re: General » Help on error of type: syntax error saw 'keyword: of' near 'of' » 2013-01-31 21:47:22

Thank you very much for the advice. I read the manual and got the idea. In Spin we use ; as a delimitator between 2 instructions, so the last instruction can be without ; . I ran the code and indeed I got the messages I wanted.

#2 Re: General » Help on error of type: syntax error saw 'keyword: of' near 'of' » 2013-01-31 20:18:23

Thank you guys for your patience. Indeed, I fixed those lines of code and I do not get the errors anymore. But still I have one more problem.
I am using iSpin to run the code. When I run the code now, I do not get any results, and no errors either. I was hoping to see the messages that are put on the channels.
Here I tried to put a screenshot.
Thanks in advance.
[img=FluxBB bbcode test]https://docs.google.com/file/d/0B-utVRGYr3F4djN0U01kVFVKUWM/edit[/img]

#3 Re: General » Help on error of type: syntax error saw 'keyword: of' near 'of' » 2013-01-31 10:33:26

Hello,

I put the ; at the end of each statement, but I get the same error.
Thanks for the advice though.

Can you give me other advice ?

#4 General » Help on error of type: syntax error saw 'keyword: of' near 'of' » 2013-01-31 08:04:02

tudor.niculescu
Replies: 7

Hello,
I'm working on an assignment. I'm trying to simulate a RIP routing protocol on a very simple topology with 3 routers. When i am running the code in ispin, i'm getting the following errors:
spin: Try1.pml:6, Error: syntax error    saw 'keyword: of' near 'of'
spin: Try1.pml:7, Error: syntax error    saw 'keyword: of' near 'of'
spin: Try1.pml:8, Error: syntax error    saw 'keyword: of' near 'of'
spin: Try1.pml:9, Error: syntax error    saw 'keyword: of' near 'of'
spin: Try1.pml:20, Error: missing array index for 'AB'    saw 'operator: !'
spin: Try1.pml:22, Error: missing array index for 'BA'    saw 'operator: ?'

Q1) Can you please give me a hint on the error Try1.pml:6, Error: syntax error    saw 'keyword: of' near 'of' ? From what I know, I defined OK the channel AB. I want to define a channel with 1 message buffer. One message contains 3 values, stored in one of the 3 byte variables.

Q2 ) What about error. Try1.pml:20, Error: missing array index for 'AB'    saw 'operator: !' ? Why is it appearing only on line 20 and 22? I used the exact same syntax for procB() and procC() at lines 43, 44, 46, 47 and other, but I do not get any error there.

Any help is apreciated. Thank you !

Here is the code that i am running:
1    byte ca[3];
2    byte cb[3];
3    byte cc[3];
4    byte a1,a2,a3,b1,b2,b3,c1,c2,c3;
5    byte nha1, nha2, nha3, nhb1, nhb2, nhb3, nhc1, nhc2, nhc3;
6    chan AB [1] of {byte,byte,byte}
7    chan BA [1] of {byte,byte,byte}
8    chan BC [1] of {byte,byte,byte}
9    chan CB [1] of {byte,byte,byte}
10   
11    proctype procA() {
12        byte vB1,vB2,vB3;
13        a1 = 0;
14        a2 = 1;
15        a3 = 16;
16        nha1 = 0;
17        nha2 = 2;
18        nha3 = 0;
19       
20        AB! a1,a2,a3;
21        do
22        ::    BA? v1,v2,v3;
23            if
24            ::    a1 > vB1 + a2 -> a1 = vB1+a2; nha1 = 2;
25            ::    a2 > vB2 + a2 -> a2 = vB2+a2; nha2 = 2;
26            ::  a3 > vB3 + a2 -> a3 = vB3+a2; nha3 = 2;
27            ::    else         -> skip
28            fi
29            AB ! a1,a2,a3;
30        od
31    }
32   
33    proctype procB() {
34        byte vA1,vA2,vA3;
35        byte vC1,vC2,vC3;
36        b1 = 1;
37        b2 = 0;
38        b3 = 2;
39        nhb1 = 1;
40        nhb2 = 0;
41        nhb3 = 3;
42       
43        BA! b1,b2,b3;
44        BC! b1,b2,b3;
45        do
46        ::    AB? vA1,vA2,vA3;
47            CB? vC1, vC2, vC3;
48            if
49            ::    b1 > vA1 + b1 -> b1 = vA1+b1; nhb1 = 1;
50            ::    b2 > vA2 + b1 -> b2 = vA2+b1; nhb2 = 1;
51            ::  b3 > vA3 + b1 -> b3 = vA3+b1; nhb3 = 1;
52            ::    b1 > vC1 + b3 -> b1 = vC1+b3; nhb1 = 3;
53            ::    b2 > vC2 + b3 -> b1 = vC2+b3; nhb2 = 3;
54            ::    b3 > vC3 + b3 -> b3 = vC3+b3; nhb3 = 3;   
55            ::    else         -> skip
56            fi
57            BA ! b1,b2,b3;
58            BC ! b1,b2,b3;
59        od
60    }
61   
62    proctype procC() {
63        byte vB1,vB2,vB3;
64        c1 = 16;
65        c2 = 2;
66        c3 = 0;
67        nha1 = 0;
68        nha2 = 2;
69        nha3 = 0;
70       
71        CB! c1,c2,c3;
72        do
73        ::    BC? vB1,vB2,vB3;
74            if
75            ::    c1 > vB1 + c2 -> c1 = vB1+c2; nhc1 = 2;
76            ::    c2 > vB2 + c2 -> c2 = vB2+c2; nhc2 = 2;
77            ::  c3 > vB3 + c2 -> c3 = vB3+c2; nhc3 = 3;
78            ::    else         -> skip
79            fi
80            CB ! c1,c2,c3;
81        od
82    }
83    init {run procA(); run procB(); run procC();}
84   
85       
86

Board footer

Powered by FluxBB