A compiler is a computer program that converts source code written in a computer language (the source language) into another computer language (the target language, providing having a binary form referred to as object code). The best reason for inadequate to convert source code is to create an executable code.
The compiler is generally used for programs that translate source code from a high-level programming language to a lower-level language (e.g., assembly language or machine code). A program that translates from a low-level language to a higher level one is a decompiler.
A program that translates between high-level languages is generally known as language translator, source to source translator, or language converter. A language rewriter is generally a program that translates the form of expressions without a change of language. A compiler is probable to implement some or all of the following operations such as lexical analysis, preprocessing, parsing, semantic analysis, code generation, and code optimization.
There are many types of software tools that have been developed to create one or more phases of the compiler. These tools are called compiler construction tools. The compiler writer uses software tools including debuggers, version manager, and profiler, etc. Some general tools have been generated for the automatic scheme of definite compiler components.
These tools use specialized language for defining and executing the components and can use algorithms that are completely refined. The most outstanding tools are those that hide the analysis of the generation algorithm and create components that can be unified into the remainder of the compiler. The following is a list of several beneficial compiler construction tools −
Scanner Generators − These generators create the lexical analysis. The fundamental lexical analysis is produced by Finite Automata which takes input in the form of regular expressions.
Example − LEX is a scanner generator provided by UNIX systems.
Parser Generators − This software produces syntax analysis which takes input in the form of the syntax of a programming language depends on context-free grammar.
Syntax Directed Translation Engines − These make a set of routines that walk the parse tree. The basic concept is that one or more translations are related to each node of the parse tree, and each translation is represented because of translation at its neighbour nodes in the tree.
Data Flow Engines − It can generate an optimized code. These tools are used in code optimization.
Automatic Code Generators − These generators take input in the form of intermediate code and convert it into machine language.