6000 lines of codes later we are finally done with our compiler project. This was perhaps the most intense course project that I have done as a Computer Science Undergrad in BITS Pilani.
Over two months or rather 2 intense weeks, each before the 2 submission deadlines we built a lexer, parser, abstract syntax tree creator, type checker, semantic analyzer and code generator.
My C concepts related to pointers, strings, memory allocation and deallocation; Assembly knowledge; and data structures knowledge has greatly improved via the project. This was truly an enriching project. Can’t believe so much work goes into writing a toy compiler for a small language. Can’t imagine the work they put into GCC.
Through the project my respect for language designers like Dennis Ritchie greatly increased. Just found Dennis’s first C compiler.
I remember reading articles that went like ‘If there was no Dennis Ritchie, there would have been no Steve Jobs’, it was something that I really didn’t believe until today. Scientists bring innovations to entrepreneurs who make it affordable and usable by the general public. Without real scientists we won’t have anything new. Reminds me of the Peter Thiel quote.
We wanted flying cars, instead we got 140 characters.
Only real scientists can get us flying cars.
I can’t share the code yet but I’ll definitely add a link to the repository as soon as the evaluations are done.
Update: The program is open source now. The semester just got over. Find the code here.