i am very weak in pointers , blame it on not having access to some good books .. while designing a compiler in c , how important is it to have a good knowledge about pointers?.. any good books??
It's really, really important that you fully understand pointers when working in C (or C++) especially. So many things come down to manipulating pointers and memory, and there are a lot of "tricks" used related to pointers that may come up during compiler development in C.
"Good books" aren't really going to help you, it's just a concept that you need to get your head around.
Google for pointer tutorials on the net, and work through them until it clicks. For example: http://home.netcom.com/~tjensen/ptr/pointers.htm
On a scale from 1-10, about 12. It's a vital part of the language, and an even more vital part of a compiler.
It is of critical importance.
That is pretty basic. If you don't know that, you are far from writing a compiler in C, since that is all about dynamic structures (trees), and the operations on them.
Parsing usually yields a tree that is sometimes transformed to another tree after semantic analysis, then modified (e.g. optimization), and then written out to a more linear format (IL or something that is one step above label-assembler)
A compiler writer needs to know about pointers, since she or he will be designing a machine to turn a high-level language such as c or pascal or perl into assembly code or machine code.
You cannot write assembly code without understanding pointers, it's just out of the question, unless you never want to have objects or globals or pass by reference or interact with the operating system to open read from files or write to a display buffer.
All of which are handy things for a user of your compiler to have.
It is very important. I started out developing (C, C++ and now Objective-C) without any knowledge and certainly not the patiantce to read about pointers. Working with them made me aware of the basics, but that was it.
It didn't cause any real problems at first, while my programs were simple, but in the long run, when my programs became more complex and my work more important (i.e.: other people depending on them), my lack of knowledge about pointers caught up on me and I had to rewrite and re-understand most of my code .. that was the bitter reality and the consequence of me not caring about something that is so important in low(er) level programming..
Also have a good understanding of garbage collection or retain counts (malloc, dealloc, new, etc. etc.) Freeing and creating objects at the right time is very, very important as well and closely related to pointers.
Even if pointers arent very much used by the programmer in modern managed-code languages they are still used in their compliers and can help you as a programmer to produce better, faster, more stable programs.
As an example I wouldn't know how to explain why you should use StringBuilder instead of string when concatenating a lot of strings without saying the word pointer:).
In C? Strings are represented as pointers (to null-terminated sequences). Several standard library functions take pointers to other functions (
qsort). There's no need to write your own linked list or binary tree implementation, but every one out there will use pointers, and expect you to understand them.
Additionally, if you want to put something somewhere other than the stack, you'll need to use pointers. Generally you'll open files and get back a "file pointer" which is a struct that you interact with as a pointer.
And then, if you intend to compile a language that has pointers itself, ...
Overall this is something you can't just get by without.
You really have to get to grips with pointers in order to successfully program in C. Without them you won't be able to properly handle memory management, implementing most advanced data structures and pretty much any other resource management. You'll also have problems dealing with arrays (as they can and will degrade to pointers in certain circumstances) so I'm afraid you'll have to learn how to use them propery.
In C you are always dealing with pointers in one way or another. It's nearly impossible to not use them and performance wise very important. So basically to develop FAST, SECURE and readable code you should make yourself familiar with this topic. There are so many good books out there... let me see... I really like "C Unleashed", but there are many good tutorials out there.
If you start writing in C/C++ it's first thing you should get to know , otherwise writing in C will be a horror . Learn how to pass pointers and data via pointers to functions , how to debug program using pointers and study the math of pointers . If you get to know this well you won't get lots of problems later