ℙ𝕖𝕡 🙴 ℕ𝕠𝕞

home | documentation | examples | translators | download | blog | all blog posts

negation in the ℕ𝕠𝕞 language

About the nom negation operator !

The nom language uses the fairly standard bang operator “!” as a negation operator. This can be put before all types of tests, such as class tests (eg [:space:] ), text-is tests (eg “abc"), begins-with tests (eg: B” abc") ends-with tests (eg: E"abc") etc.

In SED the negation operator goes after the test it is modifying, but in ℕ𝕠𝕞 the negation operator goes before

test that the workspace is not empty


   read; 
   [:space:] { clear; .restart }
   [:alnum:] { 
     while [:alnum:]; put; 
     clear; add "word*"; push; .reparse
   }
  parse>
   !"" { 
     put; clear;
     add "! Incorrect character '"; get; add "'\n";
     add "! (only alpha-numeric allowed) \n"; 
     print; quit;
   }
 

notes

The idiom above is a simple way to determine if there is a character or characters in the input-steam which is acceptable in the current language. This snippet normal goes just before the parse> label after all other characters and strings have been tokenised.

a common use of the negation operator


   !"" { 
     put; clear;
     add "! Incorrect character '"; get; add "'\n";
     print; quit;
   }
  

Double negation (!!) is not permitted because it is fairly semantically useless, and the same applies to triple, quadruple etc negation.

see also