4.4 Yacc – A Parser Generator

A number of programming languages are developed and new ones will surely be developed in future. Existing languages are being enhanced or modified. New CPU architectures are being designed and implemented. For each new language or modification in a language and for each new or modified CPU architecture, we require a new compiler. This is not a trivial requirement and those responsible for providing such compilers are dreaming if the work of compiler writing can be automated, i.e. they want to have a compiler–compiler.

A compiler–compiler (CC) will, ideally speaking, generate a compiler CL,M for a given language L and given machine (i.e. CPU instruction set), including the optimization passes (see Fig. 4.12).


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.