Debugging
Bugs make me sad :(
Take the following example:
/*
Example program showing error messages
*/
print("Starting turing machine...");
setValues(# 2 0);
setPosition(0);
print();
setCommand(
AWARENESS=2, PAGE=0,
?setTape(1)
?move(1)
?goToPage(1)
);
setCommand(
AWARENESS=1, PAGE=1,
?stop()
);
run();
print("Finished.");
Uh oh! You get the following error:
TML Exception:
No commands specified for page 1 and awareness 0
What's the issue with this program? Well, the carriage tries to go to page 1 with awareness 0, as that's what the tape is reading in the new position, but you haven't defined that! Instead, change the second command to this:
setCommand(
AWARENESS=0, PAGE=1,
?stop()
);
Ta da! Your program should have the right output of # 1 0
!
You can also get other errors, listed below.
"Invalid future function": Improper function name inside of
setCommand
(future scope)"Invalid function": Improper function name outside of
setCommand
(present scope)"Invalid function argument": Improper argument given to a function, for example, if you try to use a constant you haven't defined
"First value must be #": You must set the first entry in
setValues
to#
, or whateverSECTION_CHAR
is."Invalid print color/style option": You entered a color or style that isn't defined, so you'll need to edit the spelling to fix it (or you specified an unsupported color, like
pink
."No commands specified for page 3 and awareness '_' (none, with NONE_INT=2147483646)" - this means the machine was trying to read where there is no number defined.
Last updated