3.3 Compiler Writing Tools

Till now we have seen a few versions of hand-coded Scanners. Their designs were more or less ad hoc in the sense that a bit of common-sense and some amount of cut and try were used to implement them. As mentioned previously in Chapter 2, the operations of a Scanner can be specified in terms of a regular grammar, and systematic transformations of this grammar can give us a Scanner. The compiler writing tools such as lex and yacc use this idea to reduce the effort and time involved in implementing a compiler to considerable extent.

Before 1975 writing a compiler was a very time-consuming process. Most of the time it involved “boot-strapping” a compiler – programming in assembly language, write a hand-coded compiler for ...

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.