Refactor the stack frame handling for scripts

fixes #7748
Remove the C++ code generator

refs #7699