Comment

Comment by mjbq

Nom is a sed-inspired language for parsing text patterns, formats, and context-free and context-sensitive languages. Nom is a simple language for parsing simple languages, and for that reason it gives rise to all sorts of self translation possibilities, not just the standard "self-hosting" compiler.

In fact Nom gives rise to some interesting identies: if T is a function or relation (in this case a nom translation script) then T(X) = x where X is a nom script and x is an equivalent script or source code in some other language (eg Perl, Lua, Rust). Logically, the following holds T(T) = t So the translation script can be run on itself. Also t(T) = t So when the translated translator is run on the original script it produces itself. Writing all this in Unix-speak as regards pep/nom, we have, in the case of Lua pep -f nom.tolua.pss nom.tolua.pss > nom.tolua.lua cat nom.tolua.pss | lua nom.tolua.lua > nom.tolua.again.lua diff nom.tolua.lua nom.tolua.again.lua The last diff produces no output because the files are the same.

  - www.nomlang.org/doc/  documentation

  - www.nomlang.org/tr/  translation scripts

  - www.nomlang.org/object/  c implementation of pep interpreter
parent mjbq 5 days ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton