Monday, December 19, 2005

OldPosts: Me and compilers

I was always fond of compilers, one of the reasons i joined Faculty of computers and information was to be be able to construct a compiler.
Compilers to me means symbolic power of the ability of understading the user input. And how to be able to utilize the computing power of the machine to do extremely large things that needs tedious work of a human; by changing a few lines, you can do a big difference - imagine doing it with no computers at all - like moving a mountain along a path which follows a car! It's a strange idea but it somehow reflects my idea of the power of computers.
I always was trying to learn more about compiler since the moment - or even before - i joined the college. So i was able to gather a lot of knowledge about them before we study the Compilers course. Though it was not enough to understand them well enough to be able to actually construct a compiler, I gained enough knowledge about what we should study in that course exactly. Disappointingly, what we actually studied was only 30% of what we should, and what all other courses, outside Egypt, did study.
We have studied Regular Expressions, DFA, and Context free grammars, and LL parsing. Regular Expressions and DFA was supposed to be studied in another course ( named - as in other colleges outside Egypt : Automata theory and Formal languages), leaving more time to focus on compiling related topics - Supposedly, parsing only is a Parsing theory, so we did study Parsing theory, Not compilers. We even didn't study the full parsing theory; we should have studied LR parsing, as LL is history, and nothing compared to LR. We should also have studied Context sensetive grammars, and attribute grammars, which is essential for semantic analysis. Outside parsing theory, we should have studied Run-time environments, the link between Architecture and Compiler, and a way to enlighten us of how to produce executable files, and also of how our code we compile everyday does actually run.
Another thing that really made me mad, is the project. In graphics course we did use DirectX as a tool to implement something big. But if we did implement the low-level graphics ourselves, it would have lead us nowhere and we would have produced something that is useless and so little. The same for compilers, we should have used a Parser, and Lexer generator tools, so we can produce something big, and actually employ our - supposed - knowledge of semantic analysis and run time analysis so that we can actually produce a full working compiler for a big language and also outputs an executable file. But what happened was the opposite; we spent time and effort implementing a lexer and a parser, hardcoded, which no one in the world do anymore; even the Java CUP parser generator last version was 1999.
Finally, I would really feel sorry for being so held back, that other people did these stuff 20 years ago, and we are still doing the same. The compiler industry are way looking so much far, on the loosely typed languages, and Aspect-Oriented Programming, and Zero-code data-binding, we didn't even hear about Object-Oriented Programming in the compilers course. Hopefully, in 20 or 30 years, I will be able to feel Hope again .

No comments: