An overview of the elements of the ℙ𝕖𝕡 virtual machine
The file /doc/machine/doc.dir.index.html contains a list of pages in this folder of the documentation for pep/nom. It contains a documentation page for each element of the pep virtual machine
The workspace is possibly the most important register in the ℙ𝕖𝕡 virtual machine because almost all commands and operations manipulate it.
This is where all “text change” operations within the machine are carried
out. It is similar in concept to a register within a “cpu” or to the
SED
stream editor pattern space. The workspace is affected by (almost?) all
commands, for example the command add
appends the given text to
the workspace*. The buffer is called this because the same terminology is used for the
SED stream editor (and it’s function is similar).
The stack can contain grammar parse-tokens or anything else
the you want to put into it. You can put parse-tokens into the
ℙ𝕖𝕡 stack with the push
command and get them out with
the pop
command. The stack is designed to be automatically
synchronised with the tape array.
The tape is an array of text data which is synchronized with the
machine stack using a tape pointer and the pop
and push
commands which decrement and increment the tape
pointer respectively. The tape is manipulated with the
get
, put
and swap
commands.
The tape pointer determines the current tape element (or “cell") which” will be used by “get;” and “put;” commands. The tape pointer is incremented
with the ++
command and decremented with the --
command. This
pointer register will also be incremented or decremented on a successful
push
or pop
command. To be more explicit, if the
workspace buffer is not empty then a push command will
increment the tape-pointer and if the stack is not empty then a
pop
command will decrement the tape-pointer. This behaviour
of push and pop is very important for maintained the
tape and stack in a synchronized state and for making parsing and
compiling (more or less) simple.
This machine register is not directly manipulable. It contains
the next character in the input stream (or <null> or <eof> if
the end-of-input has been reached). This register is used by the
while
and whilenot
commands, which read the input stream while
the peep register satisfies a given condition.
The counter or “accumulator” is an integer variable which can
be incremented with the command a+
, decremented with the
command a-
, and set to zero with the command zero
.
This register contains a count of the number of lines encountered
so far in the input stream. It is automatically incremented when
a newline \n character is encountered (but not a “\r” character). It
can be set to zero with the nolines
command. Its value can
be appended to the workspace buffer with the lines
command
This register contains a count of the number of (hopefully Unicode)
characters encountered so far in the input stream. It is automatically
incremented when with each character character. It can be set to zero
with the nochars
command. Its value is appended (as text) to
the workspace buffer with the chars
command.