Re: [Haskell-cafe] concurrent definitions with parsec

2008-03-10 Thread Brandon S. Allbery KF8NH
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.

Re: [Haskell-cafe] concurrent definitions with parsec

2008-03-10 Thread Zsolt SZALAI
> > > 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. > > structuredTypeDef = try recordDef <|> recordOfDef > > -- > brandon s. allbery [solaris,freebsd,perl

Re: [Haskell-cafe] concurrent definitions with parsec

2008-03-10 Thread Brandon S. Allbery KF8NH
On Mar 10, 2008, at 9:41 , Zsolt SZALAI wrote: It is a possibility to do something like swap "recordDef <|> recordOfDef" with "recordlikeDefs " where recordlikeDefs = do { reserved "record" ; others } but that would be the dirty way... Er? Refactoring the grammar like that is the clean a

[Haskell-cafe] concurrent definitions with parsec

2008-03-10 Thread Zsolt SZALAI
Hi! I'm writing a parser for a language, with a BNF like this: Type = "type" Def Def = RecordDef | RecordOfDef ... RecordDef = "record" Body RecordOfDef = "record" "of" With a perser what uses parsec module it can be mapped to haskell easily: structuredTypeDef = recordDef <|>