creating parser function

still many bugs to fixe and changes to do