Parsing Dice Notation The syntax of dice notation follows the following grammar:

$$ Roll \rightarrow Dice | Dice'x'Int | More \quad Mod \quad More $$
$$ Dice \rightarrow Int_{1}'d'Int_2$$
$$ Mod \rightarrow '+'|'-'$$
$$ More \rightarrow Int | Roll$$
$$ Int \rightarrow &lt;integer&gt;$$

Give a leftmost derivation for the sample string:
$3d8 + 2d4x3 + 1d12 + 567$

I was able to parse the two first operands $3d8 + 2d4x3$ but I couldn't find a reasonable derivation for the rest.

My solution is like:

E -&gt; More Mod More
E -&gt; Roll Mod More
E -&gt; Dice Mod More
E -&gt; Int1’d’Int2 Mod More
E -&gt; &lt;integer&gt;’d’Int2 Mod More
...
...
E -&gt; &lt;integer&gt;’d’&lt;integer&gt; + &lt;integer&gt;’d’&lt;integer&gt;’x’&lt;integer&gt; + More Mod More
E -&gt; &lt;integer&gt;’d’&lt;integer&gt; + &lt;integer&gt;’d’&lt;integer&gt;’x’&lt;integer&gt; + Roll Mod More
E -&gt; &lt;integer&gt;’d’&lt;integer&gt; + &lt;integer&gt;’d’&lt;integer&gt;’x’&lt;integer&gt; + Dice Mod More
E -&gt; &lt;integer&gt;’d’&lt;integer&gt; + &lt;integer&gt;’d’&lt;integer&gt;’x’&lt;integer&gt; + Int1’d’Int2 Mod More


I was thinking that the given string is not a valid string for this grammar.

Does any have any idea for this problem. I'm newbie in Compiler Design :-)
Hint: Your string is of the form Dice+Dice+Dice+Int. Figure out how to obtain this from Roll using only the first, third and fourth rule.