Alchemist – A non-deterministic programming language based on chemical reactions

Alchemist – A non-deterministic programming language based on chemical reactions

A program may optionally contain constant inputs, so a full program has the form:

An alchemist program contains of the rules and a universe containing simple atoms. Then that rule is not applicable because it requires the universe to contain no atom of type . The original implementation allows multiple and rules, the evaluation of these happens as follows:

A simple example shall illustrate this:

After matching the first rule there will be one -atom and two -atom, then the next rule will be applied:

So the above program will output

The following code will output to stdout:

Using the implicit -atom, we can rewrite the above program as:

The following is a truth-machine:

The following program illustrates how more complicated control-flow with 0-rules can be achieved.

Source: esolangs.org