Sunteți pe pagina 1din 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.

S-ar putea să vă placă și