Sorry, I dont have answers to your questions as I have never tried to do the conversion to P-Code but just written interpreters for the script.

My point: Have you considered using Delphi Web Scripting as your scripting language?