100% found this document useful (1 vote)
2K views2 pages

Compiler Construction Tools

The document discusses various tools that help with compiler construction, including: 1) Scanner tools that generate lexical analyzers from regular expressions 2) Parser generators that take a language's grammar and produce a syntax analyzer 3) Syntax-directed translation engines that walk parse trees and generate intermediate code 4) Code generator generators that produce code generators to translate intermediate code to machine code It also contrasts single-pass compilers that make one pass through source code vs multi-pass compilers that make multiple passes, with multi-pass compilers able to generate more optimized programs but being slower.

Uploaded by

bijay khadka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views2 pages

Compiler Construction Tools

The document discusses various tools that help with compiler construction, including: 1) Scanner tools that generate lexical analyzers from regular expressions 2) Parser generators that take a language's grammar and produce a syntax analyzer 3) Syntax-directed translation engines that walk parse trees and generate intermediate code 4) Code generator generators that produce code generators to translate intermediate code to machine code It also contrasts single-pass compilers that make one pass through source code vs multi-pass compilers that make multiple passes, with multi-pass compilers able to generate more optimized programs but being slower.

Uploaded by

bijay khadka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Compiler construction tools:

The compiler writer like any programmer, can profitably use software tools such as debuggers,
version managers, profilers and so on. In addition to these software development tools, other more
specialized tools have been developed for helping implement various phases of a compiler. Some
of the useful compiler-construction tools are as follows:
1) Scanner Tool:
Input: Regular expression description of the tokens of a language
Output: Lexical analyzers.
These automatically generate lexical analyzers (the stream of tokens), normally from a
specification based on regular expressions. The basic organization of the resulting lexical
analyzer is in effect, a finite automation.
2) Parser Generator:
Input: Grammatical description of a programming language
output: Syntax analyzers.
Parser generator takes the grammatical description of a programming language and produces a
syntax analyzer.
3) Syntax directed translated engine:
Input: Parse tree.
Output: Intermediate code.
Syntax-directed translation engines produce collections of routines that walk a parse tree and
generates intermediate code. These produce intermediate code with three-address format,
normally from input that is based on the parse tree. The basic ideal is that one or more
“translation” are associated with each node of the parse tree, and each translation is defined in
terms of translations at its neighbor nodes in the tree.
4) Code generator:
Input: Intermediate language.
Output: Machine language.
Code-generator generators that produce a code generator from a collection of rules for translating
each operation of the intermediate language into the machine language for a target machine.
5) Dataflow analysis engine:
Data-flow analysis engines facilitate the gathering of information about how values are
transmitted from one part of a program to each other part. Data-flow analysis is a key part of code
optimization.
6) Compiler construction tool kit:
Compiler-construction toolkits provide an integrated set of routines for constructing various
phases of a compiler.

Single pass compiler vs. Multi pass compiler:


Single pass compiler Multi pass compiler

A one-pass compiler is a compiler that passes A multi-pass compiler is a type of compiler that
through the source code of each compilation processes the source code of a program several
unit only once. times.

Unable to generate as efficient programs, due to Some languages cannot be compiled in a single
the limited scope available. pass, as a result of their design.

One-pass compilers may be faster than They are not as fast as single pass compiler.
multipass compilers.

A one-pass compiler does not "look back" at Each pass takes the result of the previous pass
code it previously processed. as the input, and creates an intermediate output.

It is also called narrow compiler. It is sometimes called wide compiler.

Pascal's compiler is an example of single-pass Java’s compiler is multi-pass compiler.


compiler.

You might also like