Compiler construction was the worst course I took in college. Frankly I did not learn anything. When I was working in Xinjiang University, once I even asked Ghalip, a friend of mine who teaches compilers, how he could teach that horrible, boring class. After almost 10 years, I am taking compiler class in this semester. The instructor has very good reputation. I am also much more confident about the class, since I think I learned a lot about formal languages and automaton. I like those regular expressions and DFAs. I often play with the regular expressions too. As I expected, this time compilers class is fun. It is nothing like the compilers class I took in college. I liked the lectures. But I especially liked the projects, in which we build a real compiler. First project was Lexer and Parser. 2nd project was building the AST. 3rd project was type checking. Yesterday, I have finished the 3rd project. Now, I can parse a program, build the AST representation, traverse the AST, collect the symbols, and statically type check. Basically, if you have “i=1;” in your code, I can tell the assignment is not type correct because the “i” is boolean. The projects are interesting, but time consuming. I spent many nights for the 3rd project. I really feel “To Iterate is Human, to Recurse, Divine” now. Think about “x=b.i.k.j+a[a[a[a[c]]]] != foo()”. Right hand side of the assignment is an expression, which includes 3 expressions. What if foo() return null? How about the field expression “b.i.k.j” or the array a[a[a[a[b]]]]? Recursion made it easy, or possible if I am not wrong. Now, I can read a source code and rewrite it with beautiful indentation from the internal representation of the code. Isn’t it cool? Before I took this class, compiler is about translating the source code the the machine code. I was wrong. I learned so much stuff, but we even did not talk about the code generation yet. It is just one stage among those many stages we are learning. Next project is posted. With that project, I can tell the “x=1” in your code is never used, Eclipse tells you anyway. Maybe I can do more. I can’t wait to start the next project. I am ready to spend many days with frustration, feeling otiose, joy, anger and pleasure of achievements.
-
Recent Posts
Recent Comments
Mr WordPress on Hello world! WW on Count by two Imin on ئۇيغۇرچە كىتاپ ئوقۇسام بو… Abliz on Translation Cards 提克兰 on Uyghur or English? Archives
- June 2011
- May 2011
- March 2011
- April 2010
- February 2010
- November 2009
- September 2009
- June 2009
- April 2009
- March 2009
- February 2009
- January 2009
- November 2008
- September 2008
- January 2008
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- April 2007
- March 2007
- February 2007
- December 2006
- November 2006
- October 2006
Categories
Meta