Scan implemented in CodeGen.sml