=== Concrete Packrat Walkthrough on "a+b*c" (ok=1) === calls=14, memo_evals=11, memo_hits=3, filled=11/24 Rule\Pos 0 1 2 3 4 Expr OK(5) -- OK(5) -- -- Term OK(1) -- OK(5) -- OK(5) Factor OK(1) -- OK(3) -- OK(5) Primary OK(1) -- OK(3) -- OK(5) === Warth Left-Recursion Seed Growing on "1+2+3" === Round 1 (seed=FAIL): matched Term -> end=1, val=1 Round 2 (seed=OK end=1 val=1): matched Expr + Term -> end=3, val=3 Round 3 (seed=OK end=3 val=3): matched Expr + Term -> end=5, val=6 Round 4 (seed=OK end=5 val=6): matched Term -> end=1, val=1 stop growing (final end=5, val=6) Result: ok=1, val=6, rounds=4 === Depth Blowup: Nested Parens ((((1)))) === depth len naive_calls packrat_calls memo_hits 1 3 51 11 4 2 5 211 16 6 3 7 851 21 8 4 9 3411 26 10 5 11 13651 31 12 6 13 54611 36 14 7 15 218451 41 16 8 17 873811 46 18 9 19 3495251 51 20 10 21 13981011 56 22 11 23 O(4^d)>1e7 61 24 12 25 O(4^d)>1e7 66 26 13 27 O(4^d)>1e7 71 28 14 29 O(4^d)>1e7 76 30 15 31 O(4^d)>1e7 81 32 16 33 O(4^d)>1e7 86 34 17 35 O(4^d)>1e7 91 36 18 37 O(4^d)>1e7 96 38 === Full Packrat vs Selective Memo (Expr+Term only) on Flat Chains === terms len full_calls full_cells sel_calls sel_cells 32 63 119 107 130 43 64 127 237 214 259 86 128 255 471 427 514 171 256 511 941 854 1027 342 512 1023 1879 1707 2050 683 1024 2047 3757 3414 4099 1366 2048 4095 7511 6827 8194 2731