Experiences > Past Projects > WIG Project

WIG Project

WIG is a language for programming interactive Web services. A specification written in WIG (see picture example below) is given as input to the compiler and the output is a CGI script.

Iain, Andrew, and I worked on our wigc compiler following the grammar specifications with little modifications, as described in our final report (pdf).

Implementation decisions

The first two phases of the compiler were written using the C-based tools called Flex and Bison. Flex, the open-source version of Lex, was used to do the lexical analysis, and Bison, the open-source version of Yacc, was used as the parser. The subsequent phases of the compiler were written in C and include: tree, weed, symbol and type-checker.

The code (zip)

Challenges

The main challenge for this project was team coordination. A compiler has a very linear structure, and each milestone consisted of one phase in this structure. We wanted to have an even distribution of the work over the entire semester. This meant that each phase was to be separated in three parts and required more rigorous planning. The C language offered again some challenge in this project. We had chosen to implement the compiler in C, rather than Java, because we wanted more control over the structure of the abstract syntax tree. Each member of our team had a different knowledge of this programming language, and we needed good support from each other to resolve memory allocation errors and to understand the concepts behind everyone's code.

Solution

As for the coordination, rather than separate the work by milestone, we decided to work on each milestone in group, but it was not easy to work on the same file all at once. We relayed portion of the steps during the week and managed conflicts particularly during weekends. The C language was practiced extensively during the semester. A JOOS compiler was also part of a parallel project during this course and several ideas about the use of struct and union data structures helped us organize our code. This inspiration with the insight from Iain's skills in C helped us advance through milestones.

Result

We received an A+. In addition to the WIG grammar and specifications, we introduced more robustness into our code compared to previous versions of the compiler from the previous years. We made compiler messages more helpful and catch more irregularities from the input to help the users of our compiler find their errors more accurately. Although many implementation decisions made our compiler different from other teams and previous years compilers, a good amount of WIG source code was compiled successfully and handed to the marker to give our final grade.


by Patrick Desmarais

last updated: January 2012