During the YCP Killer project, Y2R didn't translate most YCP operators and builtins into equivalent Ruby constructs but into library calls. This was necessary to preserve behavior in various edge-case situations, mostly when nil was passed around. The resulting code is often long and hard to work with.

Example from SlideShow.rb:

total_time = Ops.add( total_time, Ops.divide(Ops.get_integer(stage, "value", 0), 3495) )

The goal of this project is to find patterns in Y2R-generated code which can be safely translated into more native Ruby code and translate them. In many cases this will require proving that the edge cases mentioned above can't happen (e.g. that passed parameters can't be nil). This will be done using static analysis on the code.

The rewriting will be performed using the Parser library.

A prototype exists already.


Similar Projects

This project is one of its kind!