
23 Dec
2008
23 Dec
'08
6:26 p.m.
On Wed, Dec 24, 2008 at 9:22 AM, Erik de Castro Lopo
My next problem is matching things like:
identifier ('.' identifier)* ('.' '*')?
I've had a look at lookAhead from Text.ParserCombinators.Parsec.Combinator but I can't get it to work.
* is analogous to the 'many' combinator, and ? can be implemented with the 'option' combinator. Parsec is all about composing bigger parsers out of smaller ones using combinators like these. One of the tricks I found early on is to understand where to use 'try' (since by default input is consumed even if a parser fails) but apart from that just read Daan's page, even though it's out of date, and look at how all these cool combinators work. http://legacy.cs.uu.nl/daan/download/parsec/parsec.html