Before we go ahead with knowing more details about a compiler, it is worthwhile to know what the formal language and automata theory have to say about a compiler. A more substantial account is given in Appendix A, but here we have bare minimum.
In formal language theory, a compiler is simply an acceptor, which reads input strings and outputs “Yes” or “No”, depending upon whether a string is in language L1 or not (see Fig. 1.10).
A compiler is useless if it does not point out errors. (Yes, but which errors?) A real compiler does this by typing out errors! It also translates from L1 to L2, but the acceptance function is still the most important. What will you do with a program which is not correct according to the syntax of the source language?
It tells you whether your program adheres STRICTLY to the rules of a particular language. These rules are given as a grammar and a compiler represents this grammar.
52.14.82.217