Parser with states