Pep and Nom

home | documentation | examples | translators | download | blog | all blog posts

the ℕ𝕠𝕞 "go" command

go to the tape cell marked with the given name.

The go command jumps to the tape cell which has been marked with the give name. The go command has 2 forms:

go to the tape-cell marked with the name "top"
 go "top"; 

go to the tape-cell marked with the text in the current tape cell
 go;

use mark and go to use the 1st tape cell as a buffer.


   begin { mark "topcell"; ++; }
   while [:space:]; clear;
   whilenot [:space:]; put; 
   # create a list of urls in the 1st tapecell
   B"http:",B"https:",B"www." {
     add " "; print; 
     mark "here"; go "topcell"; get; put; 
     go "here"; clear;
   }
   !B"http".!B"www.".!"" { add " "; print; clear; }
   & ??lt;eof> { go "topcell"; add "\n[url-list]:\n"; get; print; quit; }
 

See the script pars/eg/markdown.toc.pss for an example of using the “mark” and “go” commands to create a table of contents for a document from markdown-style underline headings.

notes

When using mark and go to allocate a particular tape-cell as a “buffer” (variable) to store a value, there may be issues when using the ++ and the -- commands. It may be necessary to realign the current tape-cell with go 'top'; after a -- command. On the other hand, there should be no issue when using the pop and push commands, because when the workspace buffer is empty, then the push command should do nothing (that is: the tape pointer is not incremented) and the same should be true of the pop command when the stack is empty (the tape pointer should not be decremented)

I have not done much language parsing/compiling with mark and go so this topic requires further experimentation.

The non-parameter version of go (that is, “go;") has not been implemented” in the pep interpreter (as of 21 feb 2025) but has been implemented in some of the translation scripts. The non-parameter version is important because it converts the tape into a kind of associative array . I believe this is important in using nom for type checking . Type checking is not strictly pertinent to context-free languages because it involves remembering the type a variable. But with the addition of an associative array to the Pep machine, type-checking becomes possible.

Never-the-less, when nom is performing a type-checking task, it will not be possible for it to also compile or translate the source code or language. This means that a compiling system with nom would have to use 2 passes .

I have not yet (feb 2025) written a type-checking script in the “Nom ” language.