adds productions and removes lambdas and A->A