[Haskell-cafe] concurrent definitions with parsec

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Mon Mar 10 10:03:21 EDT 2008

On Mar 10, 2008, at 9:55 , Zsolt SZALAI wrote:

> Er?   Refactoring the grammar like that is the clean and preferred
> way.  But if you insist, use the try combinator.
> Oh, all right, i was trying to be  loyal to the BNF in standard.

BNF doesn't necessarily apply cleanly to all types of parsers.   
Compare LALR(1) parsers (yacc, happy) to LL(1) (ideal Parsec  
grammars).  You can use the try combinator to write such grammars,  
but it imposes a potentially large amount of overhead because it may  
have to hold on to a large parse tree that might end up being thrown  

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

More information about the Haskell-Cafe mailing list