Dissolve crude salt in water first, and then add excessive BaCl2 solution: BaCl2+Na2SO4==BaSO4↓+2NaCl.
Then add excessive Na2CO3 solution: Na2CO3+BaCl2==BaCO3↓+2NaCl.
Then add excess NaOH solution: MgCl2+2NaOH==Mg(OH)2↓+2NaCl.
filter
Finally, hydrochloric acid was added drop by drop until no gas was generated: HCl+NaOH==NaCl+H2O.
2HCl+Na2CO3==2NaCl+H2O+CO2
Pure NaCl solid can be obtained by evaporating the solution.