Add support for stack frames.

Replaces local variable scopes with stack frames. This way we can later
add stack traces and proper error messages with filename and line number
tracking.