I'm asking this because I'm relatively new to interpreter development and I wanted to know some basic concepts before reinventing the wheel.
I thought of the values of all variables stored in an array which makes the current scope, upon entering a function the array is swapped and the original array put on some sort of stack. When leaving the function the top element of the "scope stack" is popped of and used again.
- Is this basically right?
- Isn't swapping arrays (which means moving around a lot of data) not very slow and therefore not used by modern interpreters?