Noisett

From Esolang
Jump to navigation Jump to search

Noisett is a minimalistic multi-agent middleware, where agents are tiny pattern-triggered peers. These agents are named "Nuts". When they receive a message, they can send other messages, if they're so inclined.

Each Nut is defined in its own text file (extension .nut), that looks like an INI file. A ".nut" file contains sections. Sections start with a name in square brackets, like this:

 example00.nut
 
 [MAIL]
  ...
  
 [LINK]
  ...
  
 [COPY]
  ...
  
 [PROG]	
  ...

The MAIL section contains incoming messages, it is the Nut's inbox. The LINK section keeps parts of the network topology. The COPY section is just a clipboard. The PROG section is where the behavior of the Nut is defined. It is possible to create additional sections programmatically.

If the PROG section of a Nut contains the following code...

 example01.nut
 
 [MAIL]
 [LINK]
 [COPY]
 [PROG]	
  * hey * > Hello world

... then this Nut will send "Hello world" every time it receives a message with "hey" in it. It's pretty straightforward. Triggers are simple glob patterns, and messages are public: this "Hello world" will always be sent to every Nut connected to this one.

There are no keywords in Noisett, only the following characters have special meanings:

 Noisett special characters list
 
 *	Wildcard
 |	End of line
 +	Check whether message matches an additional pattern
 -	Check whether message does not match a pattern
 
 >	Send a message
 <	Send a message to myself
 ^	Send a message to my Tables
 
 .	Rename myself
 
 [	Choose the current section (create it if needed)
 &	Add something to the current section
 ?	Check whether anything in current section matches a pattern
 !	Check whether nothing in current section matches a pattern
 %	Copy from current section everything that matches a pattern
 ]	Delete from current section everything that matches a pattern
 
 {	Create a topological link
 }	Delete every link matching a pattern
 
 _	Set vector filter pattern
 
 $x	Insert wildcard number x
 =	Insert my name
 @	Insert name of message sender
 €	Insert a pattern that matches everything in current section
 #	Insert name of next section
 §	Insert current section (in message) or clipboard (in section)
 ~	Insert a random element from current section
 "	Insert the following characters (escape)
 |	Insert an End of line
 

These special characters are either standalone or followed by their "arguments".

Some of them are conditions (namely + - ? and !) while some others express actions.

Code lines in the PROG section always start with a pattern. If the current message matches it, we just keep reading the line and executing actions until a condition fails (or until the end of line). Incoming messages are matched against every code line.

External resources

More about Noisett