created exec-instruction function to execute each function in the codemap, and increment the :index code pointer