Hi!<br><br>I&#39;m writing a parser for a language, with a BNF like this:<br>Type = &quot;type&quot; Def<br>Def = RecordDef | RecordOfDef ...<br>RecordDef = &quot;record&quot; Body<br>RecordOfDef = &quot;record&quot; &quot;of&quot;<br>
<br>With a perser what uses parsec module it can be mapped to haskell easily:<br>structuredTypeDef = recordDef<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;|&gt; recordOfDef<br clear="all"><br>But this way, the recordOfDef case will never be parsed at a line like &quot;type record &lt;somethings&gt;&quot;, because recordDef will win in the first place always.<br>
Is there an option or an other operation instead of &lt;|&gt; 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 &quot;recordDef&nbsp; &lt;|&gt; recordOfDef&quot; with &quot;recordlikeDefs &quot;<br>
where recordlikeDefs = do { reserved &quot;record&quot; ; 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>