This section contains 780 words (approx. 3 pages at 300 words per page) |
The compiler is a program that translates the source language (which takes the form of a written program), into machine code, the language of the machine. There are several portions to the compiler, some of the most prominent being the lexical analyzer, the syntactic analyzer, the code generation phase, and a code optimizer, which is optional. The generation of an intermediate code is also optional, but often done to facilitate the portability of the compiler to various machines.
The lexical analyzer finds the words of the source language. It is similar to a dictionary in a natural language such as English. It determines what symbols constitute words, and what types of word they are. In English, this includes words such as "cat" (N or Noun), "ran" (V or Verb), or "the" (Determinant). In programming languages these are "words" like " -sign" ( ), identifiers (user-defined identifiers or variables), and keywords (while...
This section contains 780 words (approx. 3 pages at 300 words per page) |