Skip to main content

Introduction to Compilers

Compilers and Translators



If you are unable to speak French and yet wish to communicate a French speaker then you need someone to translate English into French. The same happens with computers languages. We would like to communicate in English but the computer only understands binary - so a translator is required. Thus the basic function of a translator is to convert a SOURCE (or original) program into an Object (or binary) program.

There are three main categories of translator:
  • Assemblers,
  • Interpreters and
  • Compilers.

Under normal circumstances (ie unless great speed or compactness is required) the source program will be written in a high level language which is either interpreted or compiled.

A translator can be defined as: “A device that changes a sentence from one language to another without change of meaning.”


Comments

Popular posts from this blog

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...