• Post Reply Bookmark Topic Watch Topic
  • New Topic

Unrolling loop for a given number.  RSS feed

 
Itamar Levi
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Is there any function/utility/tool that unroles a loop (of n iterations) for a given number.


For example:
the utilityhas to unroll 3 times the next loop:



The tansformed code has to be:




Thanks
Itamar.



 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Itamar ab wrote:Is there any function/utility/tool that unroles a loop (of n iterations) for a given number.

I suspect the answer is "no" - unless someone on the same course already solved this problem last year and published their results.

I also think you need to specify the problem a bit better.

Are you saying that you need a program that can:
  • Parse a piece of text.
  • Recognise a "for" loop.
  • and THEN
  • "Unroll" it as you describe?

  • Or can it simply assume that what it's given IS a valid "for" loop? The two solutions will be quite different.

    Winston
     
    Itamar Levi
    Greenhorn
    Posts: 20
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi,

    The utility has to be able to unroll every loop (for or while loop).

    It is not important to me how it is done by the utility.
    It can be parsing the text or even do it by analyse the byte code (for example by using soot framework).

    The input is a valid java file and the out put is a transformed java file.

    I am looking if there is a utility with the capability of unrolling for a given number.

    Thanks
    Itamar.


     
    Winston Gutkowski
    Bartender
    Posts: 10575
    66
    Eclipse IDE Hibernate Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Itamar ab wrote:I am looking if there is a utility with the capability of unrolling for a given number.

    I'd very much doubt it; but to be honest, I don't know.

    Winston
     
    Itamar Levi
    Greenhorn
    Posts: 20
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Yes, I think you are right
    I'll keep looking for
    but i guess i have to write it by myself.

    Thanks Winston.

    Itamar.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!