
19 Jul
2010
19 Jul
'10
7:32 a.m.
Magnus Therning wrote:
This isn't really an answer, but more of a suggestion on how to approach parsing problems.
I tend to split things until I get down to easily handled stuff. In this case I'd probably write the following functions:
1. Parser for strings like "v55" and "v13": result type Parser Int 2. Parser for strings like "c123" and "c12": result type Parser [Int] 3. Parser combining 1 and 2: result type Parser (Int, [Int]) 4. Parser requiring a string starting with 'p ', combined with 3: result type Parser Command
That makes sense. Mike