10.7 Epilogue

Optimization is the field where most compiler research is done today. The tasks of the front-end – Scanner, Parser, Semantic Analysis – are well understood, and unoptimized code generation is relatively straightforward. Optimization, on the other hand, still retains a sizable measure of mysticism. High-quality optimization is more of an art than a science. Compilers for mature languages are not judged by how well they parse or analyze the code – you just expect it to do it right with a minimum of problems – but instead by the quality of the object code they produce.

In terms of algorithm complexity, many optimization problems are NP-complete and thus most optimization algorithms rely on heuristics and approximations. It may be possible ...

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.