Fortune is like a woman: if you reject her today, do not expect to meet with her tomorrow. Napoleon
This folder contains some example scripts in the
NOM 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.
The Pep & Nom system is currently in upheaval (may 2026) because of
the arrival of syntagma* which is implemented (partially) in
/tr/syntagma.pss . The shell scripts /tr/engine.lua.sh and
/tr/engine.perl.sh allow the “interpretation” of syntagma scripts.
Documentation for the
NOM language and
PEP 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|
perl|
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
Also the script /eg/nom.to.pss will translate a script with a simple
prompt.
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)
I will probably rewrite many of these example scripts in the syntagma language, since it is much easier to read than nom.
/tr/syntagma.pss implements the syntagma* language, which is a parsing,
compiling language built on top of nom. It compiles to nom
and provides an EBNF-like syntax.
/eg/xml.parse.pss is an
XML parser and error checker
/eg/nom.reference.syntax.pss is a syntax checker for the
NOM
language which provides precise error messages (The grammar for
begin blocks and parse> labels, needs to be updated).
/eg/json.check.pss checks the syntax of a
JSON text data file.
/eg/text.tohtml.pss transforms a “plain-text” (minimal mark-up) document
into html (this is the script that generates this website).
/eg/chat.timeline.pss implements a (simple) chatbot with the help of a
small ruby script called /eg/chat.rb
/eg/letter.typewriter.tohtml.pss which creates a letter that looks as if
it has been typed on a typewriter.
/eg/nom.tohtml.pss which colourises nom code and formats in html.
/eg/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 )
/eg/maths.parse.pss parses and error checks arithmetic infix
expressions.
/eg/maths.tolatex.pss transforms arithmetic, symbolic and logical
expressions into printable
LATEX formulas.
/eg/exp.tolisp.pss transforms an arithmetic infix expression into
LISP This is a simpler and older version of the 2 scripts above
/eg/toybnf.pss translates simple
BNF type grammar rules into
NOM scripts. This is the basis for a bnf style parsing
and compiling language
/eg/palindrome.pss which just recognises palindromes.
/eg/natural.language.pss implements a limited natural language (English)
parser. I plan to expand this with a better 'phrase grammar'
/eg/tocfoot.tohtml.pss demonstrates creating a table of contents
and a footer (for footnotes) and using markers in the source document
to place the table of contents and footers (this uses [toc] and [foot]
as markers.
text.tohtml.pss or nom.tolatex.pss
/eg/chat.timeline.pss should provide a chatbot which manages interactions with
/eg/timeline.tohtml.pss as well as support functions related to this script, such
as uploading or downloading data, editing and so forth.
I will probably try to do most implementation in the syntagma language in the future.
/eg/quill.pss