Design and implementation of optimization techniques in an expression Compiler using intermediate representation in C++
Pratibodh - Journal Editor, Ajeet Singh, Kundan Swami, Dr. Abhilasha, Tripati Gupta · PRATIBODH · 2026
The growing demand for efficient computation in compiler systems has emphasized the importance of optimizationtechniques in modern compiler design. This study presents the design and implementation of an optimizing expressioncompiler using Intermediate Representation (IR) in C++. The proposed system extends a traditional compilation pipelineby incorporating an additional IR generation phase, enabling systematic analysis and transformation of expressionsbefore evaluation. The compiler is structured into multiple stages, including lexical analysis, syntax analysis usingrecursive descent parsing, IR generation based on three-address code, and an optimization phase.The IR-based approach facilitates the application of classical optimization techniques such as constant folding, commonsubexpression elimination, and dead code elimination. These techniques reduce computational redundancy, improveexecution efficiency, and enhance overall performance of expression evaluation. The system also maintains robust errordetection capabilities across lexical, syntactic, and semantic levels, ensuring correctness and reliability.Experimental evaluation demonstrates that the optimized IR significantly reduces the number of instructions andexecution overhead compared to direct evaluation methods. The modular and extensible design allows future integrationof advanced optimizations and code generation techniques. The proposed compiler serves as both an educationalframework for