Thursday, June 22, 2006

 

Progress Marches On

I feel I've got some good stuff done this week. I still have some nagging yaml issues, but beyond that I can reconstruct an AST into a complete program, and I have at least one translation ready to go into svn.

I finally got stuff committed to svn after far too long, and got some great revisions from Audrey. I had a couple of messy if/else/if/else... statements that Audrey turned into cases. I knew cases would work better there, but I hadn't been able to get one to work. This project has really taught me the weak points in my practical knowledge of Haskell. At my school they use Lisp to teach functional programming, so my knowledge of Haskell was more theoretical then practical, as show by my problems getting a case to work correctly. Luckily I'm picking things up quickly.

Today I made a major breakthrough on how I represent the AST. Since I (will) have a number of functions that only work on one type of node for translations, I decided to abstract out nodes to a larger degree. A P5AST is now made up of AbstractNodes and LiteralNodes, with each node having a type to further narrow it down, such as (AbstractNode Op_leave []) or (LiteralNode PNothing "1" "#junk"). This allows me to abstract out functions quite a bit, it cut down the print tree function to 5 or so lines of code.

Again, my mistakes are teaching me a lot. With the stuff Audrey corrected in my code I can make further change with a better understanding. I just hope I don't feel too stupid after these revisions.

All of my work to date is available at http://svn.openfoundry.org/pugs/misc/pX/Common/P5_to_P6_Translation/ . translations.hs shows Audrey's optimizations, translate-sage.hs shows my new approach to the AST (these two will be combined to create an effective version with a better tree). AST_description sums up some details on the AST that I think are useful, mostly the stuff that I've worked out on my own. Details on the rest of the directory are summed up in the README.

Overall I feel this has been a slow week, but with some really good stuff happening in the last few days. Good stuff, as we head into the midterm review. I'd say, while my project has moved slower then I'd like, it's only going to get faster from here, and I'm on track to get at least the minimum translations done, probably more.

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?