
Many thanks. -----Original Message----- From: Brandon S. Allbery KF8NH [mailto:allbery@ece.cmu.edu] Sent: Tue 25/03/2008 20:29 To: Paul Keir; haskell-cafe@haskell.org Cafe Subject: Re: [Haskell-cafe] Parsec (Zero or One of) On Mar 25, 2008, at 16:26 , Paul Keir wrote:
Thankyou. Yes, I'd also noticed that "only end" could result in the "end" part being taken as an identifier. The language I'm parsing actually doesn't have reserved words though; so "end" and "only" are both possible valid identifiers. I should then probably replace my use of say, reserved "only", with string "only"; whiteSpace; for clarity. Still stuck though...
But now you have an ambiguity in your language, which is exactly why the parse is failing: "only end" could be waiting for "end", or for end of file / whatever tokens might follow this clause. In the worst case, the latter might lead to a situation where an unambiguous parse is impossible. You might want to provide a better description of the full language --- and think about how it would need to be implemented to avoid ambiguity. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH