From Esolang
Jump to: navigation, search

Zucchini is another minimalist language. In it, everything is a node that sends signals to other nodes.


Nodes are the atoms of a Zucchini program. Each node has:

  • An ID
  • A threshold
  • A current level
  • Targets to send values to

The main interpreter loop goes as follow:

for each node in the graph:
  if the current level is at least the threshold:
    send signals to targets

Signals are accumulated, which means that values sent are buffered for the next interpreter loop.

Special nodes

There are three special nodes:

  • Stdout
  • Stderr
  • Exit

The first two special nodes are for output to the real world. Values sent to them aren't directly sent to their respective stream. Instead, the actual output is done between iterations. Note that output happens whenever a value is sent to either stdout or stderr (so you can output NULLs). If nothing is ever sent during an iteration, nothing will happen.

The exit node is there to force the program to quit when its level is greater than zero.


Input from stdin is a special value that may appear in a node's targets. When encountered, a character is fetched from the stream, with its value converted to an unsigned integer between 0 and 255, inclusive. A -1 is sent on EOF. Multiple requests to stdin in a node's targets will only fetch a single character, duplicated between all targets.


Programs are stored as a string of nodes delimited by slashes. Each node has two parts: its threshold, and a list of targets. A target is a pair of (node ID, signal to send). The node's string index implicitly encodes its ID, starting from zero.

Thresholds and signals are encoded in a modified base 4 system, where positive integers draw from ' ' (+0), '.' (+1), '`' (+2) and ':' (+3); and negative integers use ' ' (-0), ',' (-1), "'" (-2) and ';' (-3). Zero is marked by '=', input by '-' and a node's current level by '+'.

Special nodes are not explicitely written. Instead, their IDs are:

  • Total number of program nodes for stdout
  • One more for stderr
  • One more again for exit

Example 1: in the cat program below, node 6 is ".9,10.11+". Therefore, its threshold is 1, and it sends -1 to node 9, +1 to node 10 and its level to node 11 when activated.

Example 2: again from the cat program, node 11 is ".13+". 13 is the number of nodes the program has, so when activated this node sends its level to stdout.


Hello, world!

=0,1.2./.0,1./.3.17. ` /.4.17.`../.5.17.`: /.6.17.`: /.7.17.`::/.8.17`: /.9.17`  /.10.17.:.:/.11.17.`::/.12.17.: `/.13.17.`: /.14.17.`. /.15.17` ./.16.17``/.19.



This graph shows how nodes are used: clock (blue), output (green) and exit check (red).