schaetzc/tursi

Hi. I have a question about tursi.

Uiyeon opened this issue · 3 comments

Good afternoon.
Thanks to you I can simulate the tm files.
However, when I open a file, then the Tursi said "Expected rule to 5 fields, but found 1".
Could you please tell me the reason or solution?
And I have attached my code too.
Thanks.

code:

#! fill b
#! write 1111,11,11111,1
#! start q0
#! end qend

q0 1 0 R q1
q1 1 1 R q1
q1 , , R q2
q2 0 0 R q2
q2 1 0 L q3
q3 0 0 L q3
q3 , , L q4
q4 1 1 L q4
q4 0 0 R q0
q0 , , R q5
q5 0 0 R q5
q5 1 1 R q6
q5 , , L q7
q5 b b L q6
q2 , , L q8
q2 b b L q8
# ----------------
q8 0 1 L q8
q8 , 1 L q9
q9 1 1 L q9
q9 0 0 R q10
q10 1 , L q11
q11 0 1 L q11
q11 b b R q0
q11 , , L q12
q12 1 1 L q12
q12 b b R q0
# ----------------
q7 0 1 L q7
q7 , , L q13
q13 0 1 L q13
q12 b b R q14
q13 1 1 R q14
q14 , , R q0
q13 , , L q15
q15 1 1 L q15
q15 , , R q0
q15 b b R q0
# ----------------
q6 1 1 L q6
q6 0 1 L q6
q6 , , L q16
q16 0 1 L q16
q16 , , R q17
q16 b b R q17
q17 1 1 R q17
q17, , R q18
q18 1 1 R q18
q18 , , L q19
q19 1 1 L q19
q19 , , R q0
q18 b b L qend

Hello Uiyeon,
thanks for getting in touch. I took the liberty to edit your comment such that the code is formatted properly. Please check if I did that correctly. To resolve the problem it is very important that we use the same input file.

I executed above tm file in Tursi v1.2 and got a different error than you. For me, the error was:

Couldn't parse file due to 1 error and 0 warnings.
error   (line   37): Rule for state 'q12' and symbol 'b' was already defined.

This error message seems justified as the rules q12 b b R q0 (Line 32) and q12 b b R q14 (Line 37) imply a non-deterministic Turing machine. Tursi only simulates deterministic Turing machines and therefore only accepts one rule for the state q12 and input b.

Do you have any ideas how I could reproduce your error message?

I appreciate your reply:) I am happy to get your reply.
Thanks to you I found another error(Line 37) and I revised. That was my mistake. I used a symbol which is already defined. In this case your error message is perfect.
However, unfortunately I encountered same error in Tursi v1.2. The error was
Line 1
Error: Expected rule to have 5 fields, but found 1.

I want to solve this problem too...Could you help me?
Yours sincerely

code:
#! fill b
#! write 1111,11,11111,1
#! start q0
#! end qend

#Comparing size and sort
q0 1 0 R q1
q1 1 1 R q1
q1 , , R q2
q2 0 0 R q2
q2 1 0 L q3
q3 0 0 L q3
q3 , , L q4
q4 1 1 L q4
q4 0 0 R q0
q0 , , R q5
q5 0 0 R q5
q5 1 1 R q6
q5 , , L q7
q5 b b L q6
q2 , , L q8
q2 b b L q8
# ----------------
#if a > b : swap a and b
q8 0 1 L q8
q8 , 1 L q9
q9 1 1 L q9
q9 0 0 R q10
q10 1 , L q11
q11 0 1 L q11
q11 b b R q0
q11 , , L q12
q12 1 1 L q12
q12 b b R q0
# ----------------
#a = b
q7 0 1 L q7
q7 , , L q13
q13 0 1 L q13
q13 b b R q14
q13 1 1 R q14
q14 , , R q0
q13 , , L q15
q15 1 1 L q15
q15 , , R q0
q15 b b R q0
# ----------------
# a < b
q6 1 1 L q6
q6 0 1 L q6
q6 , , L q16
q16 0 1 L q16
q16 , , R q17
q16 b b R q17
q17 1 1 R q17
q17, , R q18
q18 1 1 R q18
q18 , , L q19
q19 1 1 L q19
q19 , , R q0
q18 b b L qend

That's strange. With your updated file I only get error (line 56): Expected rule to have 5 fields, but found 4. which is also understandable because in q17, , R q18 there should be a space between q17 and ,.

I can only reproduce your error from line 1 if I include code: into the tm file. If that wasn't the problem, may I ask you to post your actual input file as a file instead of including its content as text? Maybe there are problems with the encoding that get lost when posting the file content as a text comment here.
To attach the file, rename it to something.tm.txt and then drag and drop it into your next comment. Thank you!