Sunday, April 24, 2016

All the Best ! Quick Tips for Sem Lab - Android and Compiler


All the best for the Semester Lab exams! Quick points to keep in mind while coding in lab :
1. Try to be awake while coding. And don't get fatigue. Try to be calm, and not frustrated ( I m one to say. ) and avoid mind blocks. Drink water in equally spaced intervals to keep the brain cells active and not dehydrated and it helps to keep the body hydrated too. ( Actually, if you feel thirsty, you are already dehydrated. )
2. You Must be awake while debugging the errors in your code. And I will try to put up a tutorial on how to find out the part of the code causing segmentation fault in the C programs using GDB - GNU Debugger ( Google it ).
3. While debugging logical errors, most times, we just skim through the code and follow the flow of control starting from the main in the case of a C program or the start symbol in the case of a yacc specification. I suggest you do some paper work using pencil while debugging. It has helped me out in most cases. Sometimes you will feel there's nothing to write down and find problems. Well, paper work has helped me even in such cases (even recently) ! Write some crap, but write, then see it, then think, and you will find the logical errors. It actually helps you focus better on what is happening though you might not have written every detail in your paper, and it keeps up your concentration. And this way, you won't over look stuff too. Trust me. Paper work, any day. Just be quick though :P because it takes time, but it's worth it, instead of executing the whole code in your mind palace.
4. I usually don't advice about such stuff, but this time, I think I will. Code in versions. Especially all the big codes you do in compiler lab, well, you better code in versions and test each one. Let's say you have to do YACC, first complete LEX and test if it works fine for BOTH good And bad input. Yes. Then move on to code YACC and test if it works together. It takes a bit of time, but not much, and again, it's worth it.


Mail me if you have encountered errors in the past that you were not able to solve and still remain unsolved. Errors like the weird looking "unmatched rule" in LEX specification even though you think your specification looks perfectly fine, and then the YYSTYPE related errors in YACC - LEX specifications.
And you can even ask about Android stuff. In fact I heard crazy errors that were declared as "Emulator problems. It ain't working." . Actually, those errors arose because of wrong code, but the emulators and Android Studio were blamed. I don't know what to say. But yeah, if you don't know what is happening, well, just blame the computers and try to get away with it, but beware, if the teacher says try in another computer and stuff, and if your code still doesn't work, well, you are caught.
Well, that was big, did you skim read ? :P Anyways, for anything else, just mail me.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.