simple PNM parser (on StateT)