rename script::scan to script::compile
split scanning/compiling routine into functions