Assembler and Compiler
An assembly language is mostly peculated to a certain computer, while an High Level Language is generally machined independent & thus portable.
Overview of the compilation process:
The process of compilation is:
Analysis of + Synthesis of = Translation of Source Text Target Text Program
Source text analysis is based on the grimmer of the source of the source language.
The component sub – tasks of analysis phase are:
- Syntax analysis, which determine the syntactic structure of the source statement.
- Semantic analysis, which determines the meaning of a statement, once its grammatical structures become known.
The analysis phase
The analysis phase of a compiler performs the following functions.
- Lexical analysis
- Syntax analysis
- Semantic analysis
Syntax analysis determines the grammatical or syntactic structure
or the input statement & represents it in an intermediate form from
which semantic analysis can be performed.
A compiler must perform two major tasks:
The Analysis of a source program & the synthesis of its corresponding object program.
The analysis task deals with the decomposition of the source program into its basic parts using these basic parts the synthesis task builds their equivalent object program modules. A source program is a string of symbols each of which is generally a letter, a digit or a certain special constants, keywords & operators. It is therefore desirable for the compiler to identify these various types as classes.
The source program is input to a lexical analyzer or scanner whose purpose is to separate the incoming text into pieces or tokens such as constants, variable name, keywords & operators. In essence, the lexical analyzer performs low- level syntax analysis performs low-level syntax analysis.
For efficiency reasons, each of tokens is given a unique internal representation number.
TEST:
If A > B then X=Y;
The lexical analyzer supplies tokens to the syntax analyzer.
The syntax analyzer is much more complex then the lexical analyzer its function is to take the source program from the lexical analyzer & determines the manner in which it is to be decomposed into its constituent parts. That is, the syntax analyzer determines the overall structure of the source program.
The semantic analyzer uses syntax analyzer.
The function of the semantic analyzer is to determine the meaning the meaning (or semantics) of the source program.
The semantic analyzer is passed on to the code generators.
At this point the intermediate form of the source language programs usually translated to either assembly language or machine language.
The output of the code generator is passed on to a code optimizer.
It’s purpose to produce more program.
No comments:
Post a Comment
Thanks.............