Pep & Nom

home | Syntagma | docs | examples | translators | download | journal | blog | all blog posts

When you tell a story, try to have point! "Dumb and dumber"

the syntagma example folder

This folder contains some interesting examples of the new syntagma language, which is built on top of the Pep & Nom system. Syntagma scripts tend to be much more succinct than their nom equivalent.

the language L={a(n)b(m)a(n)b(m)} in syntagma using conditions
 echo 'aabbaabb' | igma 'A:[a]+;B:[b]+;del; quad=A B A B /$1==$3 and $2==$4/;'

Xml is a context sensitive language. L = {ww} is the copy language, but I don’t think that syntagma or nom can do this unless there is some delimiter between the 2 words. For example

The copy language in syntagma

    word:[:alpha:]+;   # a sequence of alphabetic chars is a word
    del;               # ignore everything else
    Lang = word word /$1==$2/ ; 

    # condition syntax /../ only reduce if first word is the same as second 
  

But this only works if there is a non-alphabetic character between the 2 words, because otherwise, they will be parsed as a single word. Actually, there is a swap get trick for reversing the input on the tape, which might just work.

double repeat language
 L = {a(n)b(n)}

We can do this in nom using the character counter. eg

an implementation of the double repeat language in syntagma

    [a]+{ @1 := "$char"; reset $char; A:*; }
    [b]+{ @1 := "$char"; reset $char; B:*; }
    delete;   # ignore all other characters.
    L= A B /$1==$2/;