Karthik Senthil's blog

Definitional Trees : Post GSoC - Renaming of tool

Hello all,

Sorry for long delay in updating posts here. All my previous blog posts could not be uploaded here due to technical problems.

A lot major steps and milestones were reached with respect to this project. First and foremost, the tool was renamed to ruby_curry to elicit the feature of the tool i.e compile Curry to Ruby.

The code was moved to a new codebase which can be found here.

Definitional Trees : Coding Phase - Working version of compiler

Hello all,

Over the last few weeks I was unable to post my updates as blogs due to problems in uploading the same.

I have made a lot of progress in my project including many new additions and modifications to the base design of the compiler. The tool now takes a definitional tree and produces the object code in Ruby. This object code is executable. Currently the entire model is designed in Ruby but there are facilities to port the object code to any other language due to abstraction of data. Further is object code is executable and the expected output of the input program is obtained by loading the object code file into a Ruby interpreter.

Sample object code for append can be found here

I'm currently working on wrapping up stuff for the first major version release of the compiler post which a frontend for this compiler(using JSON) will be designed.

Definitional Trees : Coding Phase - Working on permutation sort example

I'm currently working on defining the definitonal tree of a Curry program to implement Permutation Sort This example has 4 operations of which I've implemented the first 2. I will be discussing and clarifying some doubts related to this example with my mentor soon, post which the new_compile procedure can be executed on it to test the same.

You can track me progress here

Definitional Trees : Coding Phase - Refactored examples

Hello all,

Over the last few days I worked on refactoring the examples thus upgrading them from the old format to a new one to use the concept of Box and expression constructors.

I also tested the new_compile method for each of these examples and verififed the corresponding output.

As always my progress can be tracked here.

Definitional Trees : Coding Phase - Completed first version of new_compile

Hello all,

Over the last few days, I worked on completing the new_compile method in order to handle all cases of the algorithm. The function is now ready and I have also tested it for 2 examples.

Further I structured new_compile to produce the H function in an external file which can then be accordingly loaded/included in order to evaluate expressions. The sample output produced by new_compile can be found here.

I also implemented a unit test to test the working of new_compile.

Now I'm working on refactoring examples in order to use them for testing the new_compile method.

Definitional Trees : Coding Phase - Design of new_compile procedure

After finishing the task of implementing N function for the evaluation of an expression, I worked on making a more robust test case for checking the "replace" functionality.

After this I started working on the new_compile procedure which will metaprogram the output H function for any definitional tree in the format as expected in tmp/h_append.rb. With respect to this I have currently completed 2 cases of the new_compile procedure. These 2 cases also required some additional utilities to aid the metaprogramming.

I am currently working on the remaining 3 cases of new_compile.

Definitional Trees : Coding Phase - Main task 1 completed

Hello all,

Sorry for the delay in reporting about my progress in the project. There has been quite a lot of changes and progress over the last few days.

Firstly, the N function(used to evaluate constructor expressions) is implemented and tested with a simple example of "Pair" operation. Also one of the sub-tasks to check the robustness and consistency of the replace function of Box has been tested .

Apart from this, there were some minor changes to H like the function directly replaces the input expression expr in all cases instead of returning a new expression in some cases.

I also worked on implementing the operations for a basic datatype called Boolean. This can now be used to test code or implement complex operations.

As always my progress can be tracked here

Looking forward to the next steps in the project :)

Definitional Trees : Coding Phase - Approach to implement flexible Expression replace feature

Hello all,

My mentor and I had a detailed discussion on how to implement a flexible and robust mechanism to "replace" an Expression. This was particularly needed in the H method. We decided to implement a wrapper class around Expressions called "Box". Any replacement will happen to this Box object which will corresspondingly reflect to other expressions using that Box.

I will be implementing this idea soon. After this, the next set of tasks include-

  1. Implement the N method for a Definitional Tree
  2. Make the compile method to produce the H function as output
  3. Implement H for Variable and Choice

Definitional Trees : Coding Phase - Restructuring the XSymbol class

Hello all,

Over the last few days I worked on building the pseudo-code for the expected H function for the example of integer_division_by_2. There were many problems and cases that were not handled which I accordingly solved by discussing with Prof.Sergio Antoy. I also worked on making the code more concise and readable by defining expression constructors like make_append, make_nil, etc.

I'm now working on restructuring the XSymbol class to easily handle the cases in the H function. Post which I will work on the next function namely N.

My progress can be tracked here

Definitional Trees : Coding Phase - Next steps for compile procedure

Hello all,

The compile procedure is now in a complete and stable state. It produces an array of rules for an input definitional tree as expected. The code for the same can be viewed here

I discussed with my mentor,Prof.Sergio Antoy about the possible next steps from here with the compile procedure. We decided to upgrade compile to produce an executable Ruby code as output rather than just an array of rules which will be picked up by another program for processing and then executed. The idea is still under consideration.

I've also updated the repository with a unit test to test the compile procedure. I'm currently working on making the test more generic (object equality rather than output string equality) and trying out some examples for producing the executable Ruby code with compile procedure.

Syndicate content