Question: MmaTranslator:-Mma:-LeafCount) too many levels of recursion

is this known limitation?

restart;
s:="regular";
MmaTranslator:-FromMma(s);
MmaTranslator:-Mma:-LeafCount(s);

Error, (in MmaTranslator:-Mma:-LeafCount) too many levels of recursion

V 2023 on windows.

1021448

restart;

1021448

s:="regular";
MmaTranslator:-FromMma(s);

"regular"

regular

MmaTranslator:-Mma:-LeafCount(s);

Error, (in MmaTranslator:-Mma:-LeafCount) too many levels of recursion

 

Download crash_leafcount_may_29_2023.mw

For reference, it should have leafcount of 1

Update

Here is another way to cause this error 

124672

expr:=Sum((n+r)*a[n]*x^(n+r-1),n = 0 .. infinity)+(-1-1/x)*Sum(a[n]*x^(n+r),n = 0 .. infinity) = 0;
MmaTranslator:-Mma:-LeafCount(expr);
length(expr);

Sum((n+r)*a[n]*x^(n+r-1), n = 0 .. infinity)+(-1-1/x)*(Sum(a[n]*x^(n+r), n = 0 .. infinity)) = 0

41

148

expr:=Typesetting:-mrow(Typesetting:-mo("&uminus0;"),Typesetting:-mcomplete(Typesetting:-mrow(Typesetting:-mn("1"),Typesetting:-mo("⋅"),Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-munderover(Typesetting:-mstyle(Typesetting:-mo("∑",Typesetting:-msemantics = "inert")),Typesetting:-mrow(Typesetting:-mi("n"),Typesetting:-mo("="),Typesetting:-mn("0")),Typesetting:-mi("∞")),Typesetting:-mo("⁡"),Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi("a"),Typesetting:-mi("n")),Typesetting:-mo("⁢"),Typesetting:-msup(Typesetting:-mi("x"),Typesetting:-mrow(Typesetting:-mi("n"),Typesetting:-mo("+"),Typesetting:-mi("r"))))))),Typesetting:-_Hold([1 %* Sum(a[n]*x^(n+r),n = 0 .. infinity)])),Typesetting:-mo("−"),Typesetting:-mcomplete(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mn("1"),Typesetting:-mi("x")),Typesetting:-mo("⋅"),Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-munderover(Typesetting:-mstyle(Typesetting:-mo("∑",Typesetting:-msemantics = "inert")),Typesetting:-mrow(Typesetting:-mi("n"),Typesetting:-mo("="),Typesetting:-mn("0")),Typesetting:-mi("∞")),Typesetting:-mo("⁡"),Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi("a"),Typesetting:-mi("n")),Typesetting:-mo("⁢"),Typesetting:-msup(Typesetting:-mi("x"),Typesetting:-mrow(Typesetting:-mi("n"),Typesetting:-mo("+"),Typesetting:-mi("r"))))))),Typesetting:-_Hold([(1/x) %* Sum(a[n]*x^(n+r),n = 0 .. infinity)])));

Typesetting:-mrow(Typesetting:-mo("&uminus0;"), Typesetting:-mcomplete(Typesetting:-mrow(Typesetting:-mn("1"), Typesetting:-mo("⋅"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-munderover(Typesetting:-mstyle(Typesetting:-mo("∑", Typesetting:-msemantics = "inert")), Typesetting:-mrow(Typesetting:-mi("n"), Typesetting:-mo("="), Typesetting:-mn("0")), Typesetting:-mi("∞")), Typesetting:-mo("⁡"), Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi("a"), Typesetting:-mi("n")), Typesetting:-mo("⁢"), Typesetting:-msup(Typesetting:-mi("x"), Typesetting:-mrow(Typesetting:-mi("n"), Typesetting:-mo("+"), Typesetting:-mi("r"))))))), Typesetting:-_Hold([`%*`(1, Sum(a[n]*x^(n+r), n = 0 .. infinity))])), Typesetting:-mo("−"), Typesetting:-mcomplete(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mn("1"), Typesetting:-mi("x")), Typesetting:-mo("⋅"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-munderover(Typesetting:-mstyle(Typesetting:-mo("∑", Typesetting:-msemantics = "inert")), Typesetting:-mrow(Typesetting:-mi("n"), Typesetting:-mo("="), Typesetting:-mn("0")), Typesetting:-mi("∞")), Typesetting:-mo("⁡"), Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi("a"), Typesetting:-mi("n")), Typesetting:-mo("⁢"), Typesetting:-msup(Typesetting:-mi("x"), Typesetting:-mrow(Typesetting:-mi("n"), Typesetting:-mo("+"), Typesetting:-mi("r"))))))), Typesetting:-_Hold([`%*`(1/x, Sum(a[n]*x^(n+r), n = 0 .. infinity))])))

MmaTranslator:-Mma:-LeafCount(expr);

Error, (in MmaTranslator:-Mma:-LeafCount) too many levels of recursion

length(expr)

863

 

Download crash_leafcount_V2_may_29_2023.mw

Please Wait...