ℙ𝕖𝕡 🙴 ℕ𝕠𝕞

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

No walking baby nephews in the park Sign in a park in a Michael Leunig cartoon

ℕ𝕠𝕞 example scripts

This folder contains some example scripts in the ℕ𝕠𝕞 script language. Scripts have the file extension “.pss”. These examples can be run using the interpreter and debugger (the “pep” interpreter) or by translating to rust | dart | perl | lua | go | java | javascript | ruby | python | tcl | c and then (maybe compiling and) running.

/doc/doc.dir.index.html contains a list of scripts and documents in this folder.

Documentation for the ℕ𝕠𝕞 language and ℙ𝕖𝕡 virtual machine is in the /doc/ folder.

The scripts which begin with ro. are solutions (or attempted solutions) to problems on the www.rosettacode.org site. For example the script ro.balanced.brackets.pss solves the balanced_brackets problem .

examples can be run with the interpreter by typing

  pep -f eg/script.pss <inputfile>
  # or
  pep -f eg/script.pss -i <inputtext>
 

Examples can be translated into rust | dart | perl | lua | go | java | javascript | ruby | python | tcl | c by running the appropriate translation script.

translate a ℕ𝕠𝕞 script into go, compile and run

   pep -f tr/translate.go.pss eg/script.pss > script.go
   go build script.go
   echo "<input>" | ./script
 

Also the script /eg/nom.to.pss will translate a script with a simple prompt.

translate a script to 'rust' with nom.to.pss and compile (with rustc)
 pep -f nom.to.pss -i 'translate script.pss to rust'

Some scripts also have self-translation (for example /eg/json.check.pss and /eg/maths.tolatex.pss and /eg/text.tohtml.pss)

some example scripts

naming

.noself. in the filenames means that there is no self-translation or self-help or self-testing in the script.

The scripts are often named for the format or language that they translate to such as text.tohtml.pss or nom.tolatex.pss

ideas for example scripts