Important of compiler design tccicomputercoaching com

Page 1

Important of Compiler Design -Tccicomputercoaching.com What is Compiler? A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or "code" that a computer's processor uses. 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 usually called a source-tosource compiler or transpiler. Compilers enabled the development of programs that are machine-independent. Before the development of FORTRAN, the first high-level language, in the 1950s, machinedependent assembly language was widely used. While assembly language produces more abstraction than machine code on the same architecture, just as with machine code, it has to be modified or rewritten if the program is to be executed on different computer hardware architecture. Difference between Compiler and Interpreter: They are both similar as they achieve similar purposes, but process is different. The compiler is itself a computer program written usually in some implementation language. Traditionally, the source language is a high level language and the target language is a low level language (machine code). The interpreter translates instructions one at a time, and then executes those instructions immediately. Phases of Compiler: Lexical analysis Lexical analysis breaks up a program into tokens Grouping characters into non-separatable units (tokens) Changing a stream to characters to a stream of tokens Syntax analysis Checks whether the token stream meets the grammatical specification of the language and generates the syntax tree. Semantic analysis A context-free grammar defines the syntax of a programming language The syntax defines the syntactic categories for language constructs


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.