Skip to content

Commit

Permalink
#302 reverting back to Paull as default left-recursion removal. Gramm…
Browse files Browse the repository at this point in the history
…ars generally are larger than with Paull. Need to investigate optimizations before deciding about optimized switch
  • Loading branch information
SamyaDaleh committed Jan 16, 2024
1 parent 0178d22 commit eb91ab6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Cfg getCfgWithoutDirectLeftRecursion() {
* loops have to be removed first.
*/
public Cfg getCfgWithoutLeftRecursion() throws ParseException {
return LeftRecursion.removeLeftRecursionMoore(this);
return LeftRecursion.removeLeftRecursionPaull(this);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ public void testRemoveIndirectLeftRecursionMoore()
.getCfgWithoutEmptyProductions().getCfgWithoutNonGeneratingSymbols()
.getCfgWithoutNonReachableSymbols().getCfgWithoutLeftRecursion();
assertEquals("G = <N, T, S, P>\n" +
"N = {S, A, S:S, S:A, A:A, A:S, A:b, S:b}\n" +
"N = {S, A, A1}\n" +
"T = {a, b}\n" +
"S = S\n" +
"P = {S:S -> a S:A, S:A -> a, A:A -> a A:S, A:b -> A:S, A:S -> a, S -> b S:b, S:b -> ε}\n",
"P = {S -> A a, S -> b, A -> b a, A1 -> ε, A -> b a A1, A1 -> a a A1}\n",
cfgwlr.toString());
}

Expand Down Expand Up @@ -269,10 +269,10 @@ public void testLeftRecursionNotRemoved()
cfg, "cfg-topdown", true);
assertFalse(cfgwlr.hasLeftRecursion());
assertEquals("G = <N, T, S, P>\n" +
"N = {N2, N2:t0, N2:N2}\n" +
"N = {N2, N21}\n" +
"T = {t0}\n" +
"S = N2\n" +
"P = {N2 -> t0 N2:t0, N2:t0 -> ε, N2:t0 -> N2:N2, N2:N2 -> N2 N2:N2, N2:N2 -> N2}\n",
"P = {N2 -> t0, N21 -> ε, N21 -> N2 N21, N2 -> t0 N21}\n",
cfgwlr.toString());
}

Expand Down

0 comments on commit eb91ab6

Please sign in to comment.