Pep and Nom
home |
documentation |
download |
blog |
all blog posts
-
index.html
-
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 ("pep") or by translating to java, c, go, python,
ruby etc and then (compiling and) running.
-
mark.format.html
-
The text format recognised and formatted by the scripts
eg/mark.html.pss
and eg/mark.latex.pss
But I am (and probably will)
use only text.tohtml.pss
for formatting.
-
text.tohtml.format.html
-
An explanation of the text-format which is rendered by the
NOM script eg/text.tohtml.pss
-
array.pss
-
Parse text format integer arrays, and nested arrays (
JSON style)
-
bash.history.comments.pss
-
This version
bash.history.comments.pss
only prints commands in the
.bash_history file which have a comment (or multiple comment lines
starting with hash) above the 'timestamp' or between the
timestamp and the bash command.
-
bash.history.pss
-
Parse a bash history file which has some explanatory
comments above or below the timestamp for commands. This is a format
that I use in my bash history file to remind me of something that I did
a while ago, and also to make it easier to search for the command.
-
bash.show.functions.pss
-
Show bash functions in a file and the descriptive comments
above them.
-
brain.1to1.c.pss
-
A script to translate the “brainf**k” esoteric language into plain
c. This version of the script uses a one-to-one compilation
of commands.
-
brain.c.pss
-
A script to translate the “brainf**k” language into plain
c. This version will try to compact strings of +++--- and >>><<< etc
into 1 c statement (not finished)
-
brainf.pss
-
a script to translate the brainf*** language
-
brainf.toclang.pss
-
A script to translate the brainf*** language into plain
c
-
clean.tohtml.pss
-
A very naive attempt to remove bad words from output [html].
Not for production use. Not finished.
-
c.to.bash.comments.pss
-
A very early and naive attempt to convert c-style comments to bash one-line
comments. Not very good because it doesn’t parse quoted text.
-
exp.recognise.pss
-
Recognises infix arithmetic (integer and variable-name) expressions.
This was an initial attempt. See /eg/exp.tolisp.pss for a
more complete example with decimal numbers.
-
exp.tolisp.integer.pss
-
Transpiles infix arithmetic integer expressions to lisp. See
/eg/exp.tolisp.pss for a version with decimal numbers
and a power ^ operator.
-
exp.tolisp.pss
-
Parsing arithmetic expressions with numbers (decimals) and variables and
the operators “+,-,/,*,^” and converting to Lisp syntax.
-
fizzbuzz.pss
-
An attempt at solving the fizzbuzz programming task. Not complete.
-
imagetext.tohtml.pss
-
This script just tests the parsing of image text in a 'minimal markup'
format, for example. This script will be incorporated into
pars/eg/text.tohtml.pss
-
json.check.pss
-
parse and check the syntax of
JSON text-data input. No
UNICODE
escape sequences. Recognises scientific numbers. I am not sure
how compliant this is with the official json syntax.
-
json.check.scinum.pss
-
Parse and check just
JSON scientific number format.
-
json.number.pss
-
Parsing the
JSON number format (with scientific numbers in the
format eg: -1.44E0123 )
-
json.parse.pss
-
A
NOM script to parse the
JSON text-data format. This is
an older version. See /eg/json.check.pss for a better
version of this.
-
line.by.line.pss
-
A not very good example of line by line reading of the input stream.
-
links.pss
-
This script attempts to convert filenames and urls into html links using some
simple word/line parsing. This could be expanded into recognising multiword
patterns.
-
lisp.pss
-
An initial attempt to parse
LISP syntax. This is quite
simple but I haven’t worked much on this script. Incomplete.
-
markdown.headings.pss
-
An early attempt to parse and format markdown-style underline
headings.
-
markdown.toc.pss
-
An attempt to recognise markdown style underline headings and
table of contents.
-
mark.html.pss
-
Parses and transforms to html a plain-text format. The grammar of
this script is quite complex, and I prefer to use bumble.sf.net/books/pars/eg/text.tohtml.pss
as the formatter now (2025) since it’s grammar it simpler and easier
to add to.
-
mark.latex.nodatelists.pss
-
Parses a plain-text document format and produces
LATEX output.
This is an older version. The quality of the
LATEX output may not
be very good.
-
mark.latex.pss
-
Parse and transform into LaTeX format a plain-text document.
The format this recognises is documented in /eg/mark.format.txt
But I am using /eg/text.tohtml.pss now for text formatting
normally, which uses the format in /eg/text.tohtml.format.html
-
multiline.pss
-
This file is just supposed to test multiline quotes and commands as they are
parsed by the
NOM compiler. It can be used with the
PEP engine or with
one of the generated engines (java, python, tcl etc) with the translation
scripts.
-
natural.language.pss
-
Very simple example of (non-practical) natural language parsing. It will
accept sentences like “the small dog eats fish.” as a valid english sentence.
-
nom.syntax.reference.pss
-
A
NOM script that checks the syntax of a nom script.
This is the “reference” implementation of the nom syntax.
-
palindrome.indoc.pss
-
This script finds all full word palindromes in a document and
highlights them. It is an adaptation of
palindrome.pss
-
palindrome.nospace.pss
-
parse and recognise palindromes while ignoring space and punctuation.
-
palindrome.pss
-
Palindromes may be one of the simplest context-free languages which are not
regular. I am not sure. In this script a series of letters (such as “aa",” aaa", bb", “bbbb” etc) is considered a trivial palindrome and will not be
reported.
-
pal.words.pss
-
Print only words that are palindromes. This uses a simple
“reverse-text” method to recognise palindromes, which is not
really the point of
PEP and [nom].
-
plzero.dec.pss
-
This script is an attempt to create a pl/0 parser/compiler
in the parse script language. It just recognises pl/0 constant
and variable declarations.
-
plzero.golang.pss
-
This script parses the teaching language pl/0 which was
defined by N.Wirth (of pascal fame) for teaching compiler
construction ("Compilerbau"). The script demonstrates the potential
of the pep machine and language. pl/0 is so limited as not to
be very useful for actual programming.
-
plzero.parse.pss
-
See
eg/plzero.pss
which is a more complete version of this
script.
-
plzero.pss
-
This script parses and 'formats' (or pretty-prints) the teaching software
language “pl/0” which was defined by N.Wirth (of 'pascal' fame) for teaching
compiler construction ("Compilerbau"). The script demonstrates the potential
of the pep machine and language. pl/0 is so limited as not to be very useful
for actual programming.
-
plzero.ruby.pss
-
This script parses and tries to translate to ruby the teaching language pl/0
which was defined by N.Wirth (of pascal fame) for teaching compiler
construction ("Compilerbau"). The script demonstrates the potential of the
pep machine and language. pl/0 is so limited as not to be very useful for
actual programming.
-
plzero.toruby.pss
-
This script parses and tries to translate to ruby the teaching language pl/0
which was defined by N.Wirth (of pascal fame) for teaching compiler
construction ("Compilerbau"). The script demonstrates the potential of the
pep machine and language. pl/0 is so limited as not to be very useful for
actual programming.
-
prices.pss
-
This script parses/recognises prices in a financial format
eg $1,234,678.22
-
print.first.paragraph.pss
-
headings
-
quoted.pss
-
more".
-
ro.balanced.brackets.more.pss
-
Attempting to solve the problem at rosetta code
rosettacode.org/wiki/Balanced_brackets
-
ro.balanced.brackets.pss
-
The
NOM script solution to the rosetta-code problem of
balanced brackets
-
ro.count.occur.substring.pss
-
This script attempts to solve the following rosetta code problem
www.rosettacode.org/wiki/Count_occurrences_of_a_substring
-
ro.csv.to.html.new.pss
-
This script attempts to solve the rosettacode (www.rosettacode.org)
challenge of converting a basic CSV (comma separated values) file
into an html table. The CSV is limited- no commas in field values
and a newline end the row. But this script allows a more realistic
CSV format.
-
ro.csv.to.html.pss
-
This script attempts to solve the rosettacode (www.rosettacode.org)
challenge of converting a basic CSV (comma separated values) file
into an html table. The CSV is limited- no commas in field values
and a newline end the row. But this script allows a more realistic
CSV format.
-
ro.odd.word.pss
-
This script solves the rosetta code problem:
www.rosettacode.org/wiki/Odd_word_problem
-
ro.reverse.a.string.pss
-
This script solves the rosetta code problem:
www.rosettacode.org/wiki/Reverse_a_string
-
ro.string.is.numeric.pss
-
This script attempts to solve the following rosetta code problem
www.rosettacode.org/wiki/Determine_if_a_string_is_numeric
-
sed.parse.pss
-
This script is an attempt to parse and check the syntax of
a 'sed' (the unix stream editor) script. If this is successful
we can modify the script to translate to other languages
(including compilable languages)
-
sed.tojava.inmain.pss
-
This script translates 'sed' (the unix stream editor) scripts
into java source code. This version has all the code in the
'main' function.
-
sed.tojava.pss
-
This script translates 'sed' (the unix stream editor) scripts
into java source code.
-
series.pss
-
This script just shows how to parse strings of characters such as 'aaaa'
'bbbb'. The code may seem complex compared to the simple task that it does.
The script
eg/palindrome.pss
and eg/palindrome.nospace.pss
achieves this
list parsing.
-
text.tohtml.pss
-
This is another version of a script to transform a “plain” (minimal markup)
text document into simple html and css. This is a rewrite of
mark.html.pss
but does not have lists. I intend to only add the structures which I use
frequently. this script is grammatically simpler than mark.html.pss
and feels easier to maintain and extend.
-
toybnf.pss
-
Creating a
BNF style language with
NOM as the compile target.
-
urls.pss
-
Only print (some) urls in the input stream. A simple
non-parsing see-and-print script.
-
word.pss
-
This script does some simple word/line parsing. This could be
expanded into recognising multiword patterns.
-
word.puzzle.pss
-
An attempt to solve newspaper style word puzzles where there is 1
essential letter and 8 possible letters which can only be used once each.
Incomplete.
-
xml.parse.pss
-
The script below was prompted by a rosettacode problem which made
me curious to see if
NOM could parse
XML properly. The
answer is yes, which was surprising to me as well.