1.4 Theoretical Viewpoint

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.

1.4.1 Acceptor and Compiler

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).

 

Compiler as an acceptor

 

Fig. 1.10 Compiler as an acceptor

 

A compiler is useless if it does not point out errors. (Yes, but which errors?) A real compiler does this by typing out errors! ...

Get Compilers: Principles and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.