basic interpreter that recognises variable scopes within square brackets