Local variables and variable scope chain

Add support for local (and global) variables and variable scope chain.