In America people drive on the right side of the road, in England they drive on the left. In India, it is optional. The Guru
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 | 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 .
pep -f eg/script.pss <inputfile>
# or
pep -f eg/script.pss -i <inputtext>
Examples can be translated into rust | dart | lua | go | java | javascript | ruby | python | tcl | c by running the appropriate translation script.
pep -f tr/translate.go.pss eg/script.pss > script.go
go build script.go
echo "<input>" | ./script
xml.parse.pss is an XML parser and error checker
nom.reference.syntax.pss is a syntax checker for the ℕ𝕠𝕞 language which provides precise error messages.
json.check.pss checks the syntax of a JSON text data file.
text.tohtml.pss transforms a “plain-text” (minimal mark-up) document into html
sed.tojava.pss transpiles a gnu SED script into the JAVA language (branch syntax with 't' etc is not supported because java has not [goto] statement )
maths.parse.pss parses and error checks arithmetic infix expressions.
maths.to.latex.pss transforms arithmetic, symbolic and logical expressions into printable LATEX formulas.
exp.tolisp.pss transforms an arithmetic infix expression into LISP This is a simpler and older version of the 2 scripts above
toybnf.pss translates simple BNF type grammar rules into ℕ𝕠𝕞 scripts. This is the basis for a bnf style parsing and compiling language
natural.language.pss implements an extremely limited natural language parser.
A script which breaks lines at a ':' character and indents the remainder 2 spaces more than the original line
guache: rough, crude, uneducated (from Bacata indigenous language)
# becomes
guache:
rough, crude, uneducated (from Bacata indigenous language)
A script to format a plain-test dictionary into html and LATEX using a standard dictionary format.
Make a “table of contents” parser: that is, extract headings from some document and format and accumulate them in a tape cell (probably the first tape cell). Also parse and translate the rest of the document at the same time. This involves making sure that multiple “pop;” statements do not move the tape pointer back to the 1st tape cell. One solution is to use mark/go to realign the tape pointer
begin { ++; mark "top"; }
read;
# .... more code
"token*token*" {
clear; get; ++; get; --; put;
clear; add "newtoken*"; push;
go "top";
}
"heading*heading*" {
clear; get; add "\n"; ++; get; --; put;
clear; add "newtoken*"; push;
go "top";
}
# I am not even sure that the go "top"; code is
# necessary
or invent a new drawing/animation/gaming language (getting ambitious which has a slightly more sensible syntax than that of the “logo” language.
The start of a drawing language is implemented in /eg/drawbasic.pss This is currently implemented as a transpiler to PYTHON