Hi!<br><br>I'm writing a parser for a language, with a BNF like this:<br>Type = "type" Def<br>Def = RecordDef | RecordOfDef ...<br>RecordDef = "record" Body<br>RecordOfDef = "record" "of"<br>
<br>With a perser what uses parsec module it can be mapped to haskell easily:<br>structuredTypeDef = recordDef<br> <|> recordOfDef<br clear="all"><br>But this way, the recordOfDef case will never be parsed at a line like "type record <somethings>", because recordDef will win in the first place always.<br>
Is there an option or an other operation instead of <|> to do the trick?<br>I cant see if the problem can be solved with parsecperm or not.<br><br>It is a possibility to do something like swap "recordDef <|> recordOfDef" with "recordlikeDefs "<br>
where recordlikeDefs = do { reserved "record" ; others }<br>but that would be the dirty way...<br><br>Do you have any advise on the case?<br>Thanks,<br>-- <br>Zsolt Szalai<br>