[Haskell-cafe] Parsec (Zero or One of)

Paul Keir pkeir at dcs.gla.ac.uk
Tue Mar 25 19:19:06 EDT 2008


Many thanks.

-----Original Message-----
From: Brandon S. Allbery KF8NH [mailto:allbery at ece.cmu.edu]
Sent: Tue 25/03/2008 20:29
To: Paul Keir; haskell-cafe at 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 at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080325/b28ac859/attachment.htm


More information about the Haskell-Cafe mailing list