refactory: move parser code from main.cu to parser.[c|h]