Computers have no practical purpose. But they can be interesting toys that show us what is not important. Mjb at nomlang.org
Show the internal state of the ℙ𝕖𝕡 machine at the time that the command is issued.
The state command displays the internal state of the pep virtual machine at the time that the command is executed. This is extremely useful for debugging and highly recommended. It even shows coloured output when executed from the ℙ𝕖𝕡 interpreter.
[:space:] {
while [:space:]; put;
clear; add "space*"; push; .reparse
}
![:space:] {
whilenot [:space:]; put;
clear; add "word*"; push; .reparse
}
clear;
parse>
pop;pop;pop;
"word*space*word*","words*space*word*" {
state; clear; add "words*"; push; .reparse
}
push;push;push;
(eof) { quit; }
Using the state command is basically a speedy version of invoking a script
with the pep interactive debugger (using the '-I' switch) which is more
powerful but a more laborious way to find out what is wrong with your script
(or my coding). The interactive debugger allows you to step through the
ℕ𝕠𝕞
program one instruction at a time and view the state
of the pep
machine (it also has many other useful commands which may be useful for
learning about the
ℙ𝕖𝕡 virtual machine ).
pep -Ie 'r;add "/";print;clear;' -i 'abcdef'
The translation scripts at www.nomlang.org/tr implement the state command with a method on the class which is usually called printState() . This is also a useful way to see if the translation scripts are working properly.