(,)
(,) or in-parens-comma is a programming language designed with the thought that Brain-Flak has too many types of brackets. To run it, you use the interpreter here.
Spec
Each command (an area in commas) has up to seven comma separated arguments, which aren’t necessarily all given and usually have different effects when not.
The first argument (var-to-access) is the argument that defines the return value (the starting value of that variable) and an un-given (None) to-access returns (each iteration) 1.
The second argument (value-to-set) defines what the variable var-to-access is set to. It does not change anything with a to-access of None, or with a to-set of None.
The third (integer output) is self-explanatory. It outputs that argument (if provided) as an integer followed by a new line.
The fourth (char output) does the same, but maps the number to a char and has no trailing new line. It also only outputs if the provided input is greater than 0
The fifth and sixth are the two parts of the condition. If the output of the fifth is at least that of the sixth (nothing is equal to nothing) then the rest runs once, and then while the fifth is greater than the sixth (it evaluates it each time), it runs the rest.
The seventh argument is the max number of iterations. The max number gotten is the absolute value of the return value of the seventh argument. It is evaluated only once at beginning.
Also, note that are variables default to 0. Also, the return values of a looping expression is the sum or the return values of each run. However, when the max loops is 0, the return value is -1.
The return values of adjacent commands are added.
The end-of-input char is -1 (which, conveniently, is equal to None in the condition)
The arguments are evaluated in the following order: first, the 7th argument, then (each iteration) the 5th then 6th arguments are evaluated and compared, and if the comparison succeeds (on first iteration of the return of the 5th is at least that of the 6th, and after that if the 5th is greater than the 6th), then the 1st argument, then 2nd, then 3rd, and then 4th arguments are evaluated, and only then is the return value of that iteration (the value of variable[return of first]) decided, and then that variable is set to the return value of the 2nd variable, and then the integer output happens, and then the string output happens. Then it loops back and evaluates the 5th and 6th again, compares them, and so on.
Flags
d: display the output/return value of the code (equivalent to wrapping the whole thing in (,,[the code]) )
D: display each expression ran and the return value of it
n: numbers are outputted with trailing spaces (default is newlines)
N: numbers are outputted with no trailing character
m: a negative max number of iterations flips the sign of the return value
M: a negative max number of iterations behaves the same as 0 max iterations
i: input is split along non-digits, and each non-empty part of the split is parsed as an integer (basically integer input)
s: output becomes the 6th and 7th arguments, and control flow becomes 3rd, 4th, and 5th.
S: the two output arguments switch places.
v: output all variables at the end of program.
Note that some implementations may not support some or all flags.
Special Vars
0: Accessing gives the next character of input, and setting defines which character of input to give next, with 1-based indexing. Setting var[0] to a number less than 1 indexes from the back (AKA setting it to -1 will next give you the last character of input)
-1: The random variable. Accessing will give a random number between 0 and 1 less than the most recent value it was set to (starting at 2)
-2: The current number of seconds since the Epoch. Setting reduces all future gets by the value it was set to (so setting it to itself means each next time it's gotten gives the time since you set it to itself)
Defaults
1: Defaults to a variable that returns one, and setting does nothing to.
2: Doesn't preform the setting operation.
3 & 4: Doesn't output anything.
5 & 6: Evaluates to -1 (equal to end-of-input).
7: No limit on number of iterations.
Examples
() returns 1.
()() returns 2.
(,,()) outputs 1.
((),()) sets variable 1 to 1 and returns 0.
((),((()))) sets variable one to the ASCII vie of the first input character.
(,,(),,()) outputs 1 infinitely.
Esoasm interpreter
function translate(bin_code) { let used = bin_code.map(a=>a[0]); let inp_code = "(()()(),(,,,,(())))((),()()()())"; for (let line of bin_code){ for (let item of line){ inp_code += `${item>0?'(':''}((),(())())${item>0?`,${'()'.repeat(item)})`:''}`; } } inp_code += ` (()(),(()))((()),(()()()))((),()()()) (, ((),(())()) (,(((())())(()()),((())()()),(),((()))()),((()))(),(),()) (,(((())())(()()),(((())()())(()())),(),((()))),((())),(),()) (,(((())())(()()),(((())())(()()))((())()()),()(),((()))),((())),()(),()) (,(((())())(()()),(((())())(()()))(((())()())(()())),()()(),((()))),((())),()()(),()) (,(((())())(()()),(((())())(()()))((())()(),,,,(()()())),()()()(),((()))),((())),()()()(),()) (,(((())())(()()),(((())())(()()))(((())()())(()()),,,,(()()())),()()()()(),((()))),((())),()()()()(),()) (,(((())())(()()),(((())())(()()),,((())()(),,,,((())()())),,((())()())),()()()()()(),((()))),((())),()()()()()(),()) (,(((())())(()()),(((())()())(()()),,(((())())(()()),,,,(((())())(()()))),,(((())())(()()))),()()()()()()(),((()))),((())),()()()()()() (),()) (,(((())())(()()),((((())()())(()()))(()())),()()()()()()()(),((()))),((())),()()()()()()()(),()) (,((((())())(()()))(()()),(((())()())(()())),()()()()()()()()(),((()))),((())),()()()()()()()()(),()) (,(,((),((())()(),,(),,()()())(),(((())())(()()))(),(),()),()()()()()()()()()(),((())),()),((())),()()()()()()()()()(),()) (,(,((),(((())()())(()()),,(),,()()())(),(((())())(()()))(),(),()),()()()()()()()()()()(),((())),()),((())),()()()()()()()()()()(),()) (,(((())())(()()),(((())()())),()()()()()()()()()()()(),((()))),((())),()()()()()()()()()()()(),()) (,,((())),()()()()()()()()()()()()(),,(((())())(()()))) ((),(())()()) ,((())())) `.split`\n`.join`` return inp_code; }
Run the resultant code with the flags sSm