Apply the left-corner transform to a given grammar, removing direct and indirect left recursion.

Note that the new domain will contain O(n*t + n^2)
non-terminals where n is the amount of non-terminals and t is the
number of tokens, so when using this transformation, it can be beneficial to
use a token type with a more limited amount of token values than Char, at
least if you will use algorithms that fold over the full new grammar's domain
(e.g. printGrammar does, printReachableGrammar doesn't).