Here is a very simple language definition:
A Variable is any string that does not contain ^, <, >, !, or ? The empty string is a valid variable identifier The value of every variable starts at 0. A Statement is one of (var is a Variable, P is a Program): var^ -> changes var to be equal to 1 more than itself var<P> -> while var > 0, changes var to be equal to 1 less than itself, then runs P var! -> output value of var var? -> ask for non-negative integer as input, increase var by that value A Program is a concatenation of Statements, running a Program means running each Statement in order
Example programs (note that the empty string is a variable, but I will use it sparingly for the sake of clarity, and some variables are zeroed out in the program when they are usually 0 by default):
<>: sets the value of the empty string variable to 0 b<>b?b<a^>: asks for b, then adds the value stored in b to a, zeroing b in the process b<>b?a<>b<a^>: asks for b, then sets a to the value of b, zeroing b in the process a<>c<>b<a^c^>c<b^> : copies the value in b into a without zeroing it b<>c<>a<c^c^c<b^>>b! : outputs a multiplied by 2 b^b<a<>a?a!b^> : outputs what you input, forever
Your goal is to write the smallest interpreter for this language.
The value of a variable can be arbitrarily large and should only be limited by the total memory your language has access to, in theory, but you are only required to handle values up to 2^256.
Your program should be able to handle arbitrarily long programs, in theory, but you will only be required to work on programs under 2^32 characters long. You are required to handle nested loops of depth up to 2^32 as well.
You can assume that the program is a valid program, and that you will only ever get non-negative integers when you ask for input. You can also assume that only ASCII printable characters are included in the input string.
The speed of the program you interpret doesn't matter, it will already be painfully slow for things as simple as 5-digit multiplication, without optimization.
If you want to use a language which cannot reasonably accept input or produce output in the way described by the language, use any interpretation you want to make it possible. This applies to any reason your language can't implement some required behavior. I want all languages to be able to compete.
Shortest program wins. Standard loopholes apply.