in reply to Regexp::Grammars Calculator

I have only done a quick look at Regexp::Grammar up to now, so I don't know the exact grammar you need, but basically you can reach your goal by first switching the operands around so that for example  <X=Mult> <Op=([+-])> <Y=Answer> becomes  <X=Answer> <Op=([+-])> <Y=Mult>

This of course creates a left recursive grammar which you need to remove. So you need to change the grammar according to one of the recipes mentioned in Eliminating Left Recursion in Parse::RecDescent