Timeline

March 2002

I have decided to choose the honours project with title "Adding high-level modelling to HAL" offered by Dr Maria Garcia de la Banda and Professor Kim Marriott. During the first week of March, I had a few meetings with Dr Maria and got to know the project better. I also started reading the Optimization Programming Language book to get to know OPL better. At our first meeting, we discussed the aims of the project from my supervisors' perspective, and also what I expect to achieve at the end of this project. We also settled room allocation, computer access account and weekly meeting time. I was given some papers and books to get to know the whole project better.

April 2002

I was introduced to Mercury, a logic programming language that will be used to implement the compiler for this project. The reasons for choosing Mercury are its maturity, the availability of many useful libraries such as Lex and Moose, the robustness and efficiency of the generated code, and its closeness to the HAL language. (Mercury can be considered a subset of HAL, and HAL is compiled to Mercury). I started learning the syntax of Mercury, and wrote several simple Mercury programs to enhance my understanding. Among the first few programs I have written is a simple lexer created using Lex. Later in that month, I also tried to integrate the parser generated by Moose together with the lexer. It has been a while since I created a simple compiler, it took me a while to get the hang of it. I also started writing my research proposal with some assistance from both my supervisors.

May 2002

By May, after submitting the Research Proposal, I started translating all the OPL grammar rules to equivalent Moose format. Previously, I have created the lexer that recognises all the input tokens and reserved words in OPL. In total, there are 180 tokens with 132 grammar rules. During the course of translation, I made a mistake of not observing the precedence of the operators. In the end, I have to recreate the grammar rules from scratch and make sure the operator precedence are built into the grammar rules. During that whole month, I spent a lot of time learning the syntax of OPL, Mercury and HAL. It was an overwhelming experience because HAL is not yet released and there is virtually no documentation on the HAL syntax.

June 2002

The compiler was tested with all the OPL models from the OPL book. Out of the 35 models, the compiler failed to parse 3 models. There are a few reasons for this, there are some ambiguities in the grammar rules which are still not resolved. Also, upon close examination, some of the grammar rules in OPL book was found to be incorrect. In the end, much time was spent on eradicating the errors and ambiguities in the grammar rules. It was not until mid June, that I have successfully parse all the model files. After that, I started translating OPL data structures section. Certain problems encountered during this phase includes the translation of complex recursive data structures like arrays of struct and struct with arrays as members. Another notable problem is the lack of certain data structures from HAL like arrays. The preparation time taken to practice the interim presentation was well worth the effort, the whole presentation went smoothly.

July 2002

In the course of translating the OPL statements, I found that attribute grammars alone are not sufficient to assist in code translation. What I need is something like a global variable. In the end, the solution was a type table and identifier table. The type table stores all the type information declared by the user, while the identifier table stores all the variables declared in a model file. With these two data structures, the compiler is capable of performing limited type checking and replacing variable names with the actual values. The compiler is capable of handling data structures declaration and simple inline initialisation. During discussion, my supervisors came out with a solution to solve the arbitrary data type indexing and user-defined range indexing problems. I followed the instruction and implemented the solution successfully. Judging by the work I have done, this month is in fact very productive.

August 2002

I have commenced the writing of literature review after several months of reading papers from the related field. To mimic OPL's ability to separate model from data instance, a separate parser that parsers the data file is to be created and integrated into the existing compiler. However, because this feature is not on top of the list of priorities, it was put aside. By mid August, I begin translating the OPL constraint section. This section is huge and is also one of the most important section in an OPL model. A few data structures were created to store the expressions meaningfully without ambiguities, this enables code tranlation to be performed later when the compiler is certain the whole expression is seen. The HAL library extension, HAL++ was extended to handle certain features not available in HAL, like arrays, forall, tryall and sum.

September 2002

A lot of effort was devoted to ensure high-level modelling constructs in the search section like forall and tryall are translated properly. The hardest part in translating this constructs is when they are used iteratively. It took me a while to get the whole thing working, but the end result was well worth the effort. I have also started writting the implementation section of the thesis, since I know this part well.

October 2002

The one last thing that I need to do is to translate forall and sum in the constraint section. The handling of forall was straight forward because a similar translation has been performed in the search section. The only problem is the integration of sum and forall. After resolving the problems, the compiler was tested with OPL models from the book, it was found that the compiler handles most cases well. The result is really encouraging.

November 2002

The thesis is almost ready, I just need to put some finishing touch and make sure there is no spelling error. The final thesis is 30 pages long. Phew, what an effort~! I am glad that it is over, cannot believe what I have done. The next thing on the agenda is the project website.


Page last updated : November 10, 2002

Location : Timeline

Adding high-level modelling to HAL