How to design a compiler??

India
April 8, 2011 3:12am CST
I am persuing MCA... And I m in 4th sem now.. We have "COMPILER Design" in our syllabus.. I dont understand how to construct NFA and DFA for a regular expression?? Can anyone help me in explaining this??
1 response
@tenrajj (911)
• Bhutan
8 Apr 11
Well I am doing B Tech in computer science and I am done with compiler design course this semester. Construction of Deterministic finite automata and Non deterministic finite automata are actually included in course called theory of computation. Theory for computation is the basic course to be studied before compiler design. DFA and NFA are required for compiler design but not to that extend. At the beginning of the course we will feel like we will have to know a lot about DFA and NFA but when you proceed further, you will find much more interesting and important. It is not really necessary to understand them fully. If you really want to know, then I don't think you can learn here. I mean it will take time to understand. Better refer text book and search in internet. Lots of PDF and PPTs can be found explaining DFA and NFA I too post a similar questions few days before regarding compiler design and I got no response and I got a feeling that in real world such theory subjects or courses are not really useful. Just check one of my past dicussion http://www.mylot.com/w/discussions/2503161.aspx which is related to compiler design. You will come over this topic and it will be much more difficult to understand.
@tenrajj (911)
• Bhutan
8 Apr 11
The text books that i would like to suggest you are 1.Introduction to Automata Theory, Langauge, and computation(third edition) by Johne .hopcroft, Rajeev Motwani and Jefferyd for learning DFA and NFA. 2.Compilers, princiles, Techniques, and tools( second edition) by ALfred V.Aho, Monaica S.Lam, Ravi Sethi and Jeffrey D. Ullman for full compiler design course. This is the best compiler design book.
• India
9 Apr 11
Thanks for your valuable suggestion!!! Hey do you think is this subject interesting??
@tenrajj (911)
• Bhutan
9 Apr 11
I think it depends upon the teacher who teaches it and also on your interest. As a subject it is not so interesting to learn as in includes lots of theories. For me as we had good professor it was not so boring. Lab will be little more interesting as you will be learning lex and yacc and some parts of compiler. Enjoy the subject!