I donβt think that such a tool exists, since refactoring is usually aimed at increasing productivity, but not at reducing it (which is the case when using recursive methods instead of loops). If this is for educational purposes, why not get students to create a tool that would do this? Thus, they could learn at the same time as recursion and analysis.
, , . , , :
loopFunc()
{
for (initialization ;
test ;
counting_exp
)
{
loop_body
}
}
: initialization, ( ); test, , ; counting_exp, , ; , , loop_body, , .
: , - :
recFunc()
{
initialization
innerRecFunc(context)
}
innerRecFunc(context)
{
if not test then return
else
{
loop_body
counting_exp
innerRecFunc(context)
}
}
, 100% , , . , (while, do while).