SendStuff
From Esolang
This esoteric programming language involves creating nodes to send the result(s) of the command (which can be only non-negative integers) to other nodes. There is no variables, strings, or anything else like that, only nodes and send number to another nodes.
I don't know if it is turing complete, but you can put comments on the talk page if you have questions or suggestions. If you are sure you have perfect proofs either way, you can post directly on here. If it isn't turing complete then maybe I can make a extended version of SendStuff for turing-complete.
Contents |
[edit] Language Overview
The syntax of a node is:
- First a character to define the type, a vertical bar if it is neither the input nor output of the parent node, greater than sign if the parent node sends to this node, or less than sign if this node sends to the parent node.
- Next optionally can be the name of the node, which must be unique for the whole program and can contain uppercase, lowercase, numbers, underscore, and periods, and it is case sensitive.
- And then a left parenthesis for starting it.
- And then the command (see the command list).
- And then the parameter for the command, which is a non-negative integer. If parameter is not given it is assumed to be 0.
- And then the child nodes are next.
- At the end is right parentheses.
It is also possible to send to (and receive from) nodes already defined by just the type and name, without parentheses. You don't need both send and receive indicated on every node, just one of them is OK. If you put both, it will do twice, but it can also do twice by just repeating the name twice. It will send in the order that it is given. If less than sign are used, those will be sent to this node before other send with greater than sign on the sending node.
The syntax of a macro definition is:
- First is a at sign, followed by the name of the macro.
- Next a left parentheses for starting it.
- Next is all of the nodes defined in the macro. Macros cannot be nested.
- At the end is right parentheses.
To invoke a macro (and create all of the nodes it includes) is:
- A exclamation mark
- Name of macro
- And parameter. That's it.
Inside of a macro definition you can include $ for a unique identifier and % for the parameter of a macro. Names without $ can be included in a macro, but if you do, its parameters and child nodes cannot have $ or % in it. Remember that even the macro name and parameter for invoking is possible to have $ or % in it, if it is in the part of the definition for another macro.
Comments are indicated by # and last until end of a line.
At the root you do not write the name or the command, but it will send 0 at start of program to indicate it has started.
Sometimes a command can send no result, one result, or possibly many results in a order. Multi results will be sent after the nodes it sends to are finish, it will try the next one. If the node is already sending some results and it is called again recursively, then it will send the new results and afterward all of that is also finish, then when the other previous calls of the node are finish it will continue the old one again if any are remaining.
[edit] Commands
The commands are:
- Input: When it receives anything, it input a ASCII (or Unicode) character and sends the input character. Send nothing for EOF.
- Output: It output a ASCII character the number it receives, and it send nothing.
- InputNumber: When it receives anything it will input a number and send the result.
- OutputNumber: The received number will be written to output (as a number), and it send nothing.
- Constant: Whenever it receives anything it will send its parameter.
- Add: Add its parameter to received number and send the result.
- Subtract: Subtract its parameter to received number and send the result. If result is negative, it send nothing.
- Multiply: Multiply its parameter by received number and send the result.
- Divide: Divide its parameter by received number and send the result, rounding down always. If divide by zero, it send nothing.
- DivideBy: Divide received number by parameter and send the result, rounding down always. If divide by zero, it send nothing.
- Modulo: Modulo its parameter by received number and send the result. If modulo by zero, it send nothing.
- ModuloBy: Modulo received number by parameter and send the result. If modulo by zero, it send nothing.
- CountUp: Send all numbers 0 up to received number (includes both).
- CountDown: Send all numbers received number down to 0 (includes both).
- Interleave: Interleave parameter with received number, send result.
- LeftHalf: Does left-half uninterleave of received number.
- RightHalf: Does right-half uninterleave of received number.
[edit] Examples
[edit] Hello, World!
>(Add 72 >(Output)
>(Add 29 >(Output)
>(Add 7 >(Output)
>(Output)
>(Add 3 >(Output)
>(Subtract 67 >(Output)
>(Subtract 12 >(Output)
>(Add 55 >(Output)
>(Add 24 >(Output)
>(Add 3 >(Output)
>(Subtract 6 >(Output)
>(Subtract 8 >(Output)
>(Subtract 67 >(Output)))))))))))))
[edit] Cat
>start(Input >(Output) >start)

