You are on page 1of 5

Synopsis of System Software

Topic:- Stage Compiler

Submitted By :Lalit Kumar Singh Roll No :- RM1802B45 Reg No :-10810792 Class :- B.Tech C.S.E

Introduction
A compiler is a computer program that transforms source code written in a programming language into another computer language. The most common

The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a lower level language (e. A compiler is likely to perform many or all of the following operations: lexical analysis. and code optimization. is syntactically correct. the instruction xyz++. Syntax Analysis Syntax means "grammar" and the syntax analyser in a compiler checks that the right tokens appear in the right order to make grammatically correct instructions. source to source translator. but if the variable xyz has not been declared. whether classes are accessed correctly etc.. e. A language rewriter is usually a program that translates the form of expressions without a change of language. semantic analysis. xyz++.xyz+ is not . assembly language or machine code). Semantic Analysis The word "semantics" refers to meaning. This refers to aspects such as whether the variables have been declared. Translation .the order of the tokens is wrong. or subroutines. If the compiled program can only run on a computer whose CPU or operating system is different from the one on which the compiler runs the compiler is known as a cross-compiler. but the instruction +. code generation. A program that translates between high-level languages is usually called a language translator. or language converter. preprocessing. in C++. parsing.g. then it is semantically incorrect! The semantic analyser checks not only variable declarations and scope. but whether the program has entered or left loops. and the semantic analyser checks the meaning of the program. For instance.reason for wanting to transform source code is to create an executable program.g. A program that translates from a low level language to a higher level one is a decompiler. may be syntactically correct.

So compilers were split up into smaller programs which each made a pass over the source performing some of the required analysis and translations. The disadvantage of compiling in a single pass is that it is not possible to perform many of the sophisticated optimizations needed to generate high quality code. What are different types of compilers ? -Single pass compiler -Multi pass compiler -Cross compiler -Optimizing compiler One-pass versus multi-pass compilers Classifying compilers by number of passes has its background in the hardware resource limitations of computers. but the amount of time it takes to produce the executable representation will vary as will the amount of optimization.. The following diagram shows one representation of the differences.g. For instance. the first pass needs to gather information about declarations appearing after statements that they affect.it can immediately execute and evaluate. In some cases the design of a language feature may require a compiler to perform more than one pass over the source. The structure of the interpreter is simila to that of a compiler. It can be difficult to count exactly how many passes an . with the actual translation happening during a subsequent pass. Many languages were designed so that they could be compiled in a single pass (e. Compiling involves performing lots of work and early computers did not have enough memory to contain one program that did all of this work. consider a declaration appearing on line 20 of the source which affects the translation of a statement appearing on line 10. In this case. The ability to compile in a single pass is often seen as a benefit because it simplifies the job of writing a compiler and one pass compilers generally compile faster than multi-pass compilers. Pascal).

and many more are also a subtype of this. OpenMP) or language constructs (e.g. equivalent program. Python. Bytecode compilers for Java. there are several other types: A "source-to-source compiler" is a type of compiler that takes a high level language as its input and outputs a high level language. used by Smalltalk and Java systems.Net's Common Intermediate Language (CIL)  Applications are delivered in bytecode. single. For example. For instance. an automatic parallelizing compiler will frequently take in a high level language program as an input and then transform the code and annotate it with parallel code annotations (e. different phases of optimization may analyse one expression many times but only analyse another expression once.optimizing compiler makes. like some Prologimplementations  This Prolog machine is also known as the Warren Abstract Machine (or WAM).  Just-in-time compiler.  .  Stage compiler that compiles to assembly language of a theoretical machine. Splitting a compiler up into small programs is a technique used by researchers interested in producing provably correct compilers.g. which is compiled to native machine code just prior to execution. Proving the correctness of a set of small programs often requires less effort than proving the correctness of a larger. and also by Microsoft . While the typical multi-pass compiler outputs machine code from its final pass. Fortran's DOALL statements).

THANK YOU .