Skip to main content

Posts

Showing posts with the label Compiler

Compiler Construction Tools

The compiler writer, like any software developer, can profitably use modern software development environments containing tools such as language editors, debuggers, version managers, profilers, test harnesses, and so on. In addition to these general software-development tools, other more specialized tools have been created to help implement various phases of a compiler. The most successful tools are those that hide the details of the generation algorithm and produce components that can be easily integrated into the remainder of the compiler. Some commonly used compiler-construction tools include: 1. Parser generators that automatically produce syntax analyzers from a grammatical description of a programming language. 2.   Scanner generators that produce lexical analyzers from a regular-expression description of the tokens of a language. 3. Syntax-directed translation engines that produce collections of routines for walking a parse tree and generating intermedia...

Structure of Compilers

Mapping of a source program into a semantically equivalent target program is divided into two parts: analysis and synthesis. The analysis part breaks up the source program into constituent pieces and imposes a grammatical structure on them. It then uses this structure to create an intermediate representation of the source program. The analysis part also collects information about the source program and stores it in a data structure called a symbol table, which is passed along with the intermediate representation to the synthesis part. The synthesis part constructs the desired target program from the intermediate representation and the information in the symbol table. The analysis part is often called the front end of the compiler; the synthesis part is the back end. Compiler operates as a sequence of phases, each of which transforms one representation of the source program to another. These phases are: Lexical Analysis The lexical analyzer is the interfac...