Based on this closed question on stack overflow, what is the shortest way to stimulate scope for variables in an input. For simplicity,
copying critical information from the linked source:
]start and end a new scope.
Within scopes any changes to a variable outside of that scope is not permanent and is reverted when the scope has left, but the outer values are used to determine if a variable is undefined and its starting value.
Input will always start with
[and will end with matching
If its not defined then value should be
All input that is not a variable is a number with no decimal points. as in
> ameans print the contents of
a bassigns the contents of
Variables should be considered strings:
one 1is valid syntax
It is not required for the input to contain the print command
Note on scoring:
You may chose how to input and output the "code", but it should be explained in the answer.
I answered this on the linked page in java, but I did not go for shortest code.
Comment any suggestions or questions, so I can improve my future posts. Shortest code by character wins. Good luck.