• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Unrolling loop for a given number.

 
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.



 
Bartender
Posts: 10777
71
Hibernate Eclipse IDE 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: 10777
    71
    Hibernate Eclipse IDE 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.
     
    brevity is the soul of wit - shakepeare. Tiny ad:
    the value of filler advertising in 2020
    https://coderanch.com/t/730886/filler-advertising
    reply
      Bookmark Topic Watch Topic
    • New Topic