Pep & Nom

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

Higher and higher, baby. It's a livin' thing, its a terrible thing to lose. Its a given thing. What a terrible thing to lose ELO

syntagma, a new language for parsing

The folder /syntagma/doc/ will contain documentation for the syntagma language The folder /syntagma/eg/ contains a few examples of syntagma scripts such as:

Syntagma builds upon the simplicity of nom for parsing, translating and compiling textual and linguistic patterns. Syntagma is implemented in the nom script /tr/syntagma.pss and also in the interpreters and /tr/engine.perl.sh These are shell scripts which compile a syntagma script into nom, and then run it either using the pep interpreter or a translated translation script, such as /tr/nom.tolua.lua or /tr/nom.toperl.pl

Syntagma is a higher-level language compared to nom, which reads more like and intermediate format language. Below is the code to create some literal tokens and a parse rule in syntagma and also nom.

some code for comparison.

   lit: [.,=+-];                         # syntagma
   [.,=+-] { add "*"; push; .reparse }   # nom 
   
   a = b c;                       # a parse reduction rule in syntagma 
   pop; "b*c*" { clear; add "a*"; .reparse } push;    # the same in nom
 

The nom version is more verbose and potentially more cryptic. Syntagma uses the same model and text-register virtual machine as nom, but it provides a simpler syntax.