How to solve the following left recursion? A common left recursion: 

A -&gt; Aa | B


can be solve by transforming it into:

A  -&gt; BA'
A' -&gt; aA' | E


However, I face another similar yet different left recursion when I'm writing my compiler:

A -&gt; (A|B) a


So, my question is, how to solve such left recursion?
Rewriting (A|B) a as Aa | Ba allows you to apply the solution you already have (with Ba instead of B).