Explain analysis and synthesis phase of a compiler, Computer Engineering

Assignment Help:

Explain analysis and synthesis phase of a compiler.

The synthesis and analysis phases of a compiler are:

Analysis Phase: In this breaks the source program in constituent pieces and makes intermediate representation. This analysis part can be divided along the phases as follows:

1. Lexical Analysis- The program is seems as a unique sequence of characters. Its analyzer reads the program from left-to-right and then sequence of characters is grouped in tokens-lexical units along with a collective meaning.

2. Syntax Analysis- It is also termed as Parsing. Tokens are grouped in grammatical phrases represented through a Parse Tree that provides a hierarchical structure to the source program.

3. Semantic Analysis- The phase of semantic analysis checks the program for semantic errors (i.e. Type Checking) and then gathers type information for the successive phases.

Type Checking is check types of operands; not any real number as index for array and so on.

Synthesis Phase: Produces the target program from the intermediate representation. The part of synthesis can be divided along the phases as follows:

1. Intermediate Code Generator- An intermediate code is produced as a program for an abstract machine. The code of intermediate must be easy to translate in the target program.

2. Code Optimizer- Such phase attempts to enhance the intermediate code therefore faster-running machine code can be acquired. Various compilers adopt various optimization techniques.

3. Code Generator- In this phase generates the target code containing assembly code. Now

 1. Memory locations are chosen for each variable;

2. Instructions are translated in a sequence of assembly instructions;

3. Intermediate and variables results are allocated to memory registers.


Related Discussions:- Explain analysis and synthesis phase of a compiler

What are the differences between one hot and binary encoding, What are the ...

What are the differences between one hot and binary encoding? Common classifications used to explain the state encoding of an FSM is Binary or highly encoded and one hot. A bin

Self knowledge - characteristics of an experts system, An experts system ...

An experts system has knowledge that lets it reason about its own operations plus a structure that simplifies this reasoning process. For example if an expert system

What is master slave kernel, Q. What is Master slave kernel? Master sl...

Q. What is Master slave kernel? Master slave kernel: In this model just one of processors is assigned as Master.  The master is in charge for subsequent activities:  i)

Datatype functions for message passing, Q. Datatype Functions for Message P...

Q. Datatype Functions for Message Passing? Datatype: It denotes type of data in message. This field is essential in the sense that MPI supports heterogeneous computing and diff

Define smtp, SMTP Simple Mail Transfer Protocol, a protocol for sending...

SMTP Simple Mail Transfer Protocol, a protocol for sending e-mail messages among servers. Most e-mail systems that send mail over the Internet use SMTP to send messages from si

Pc configuration and troubleshooting, You have been asked to become the con...

You have been asked to become the consulting technician for MobTex, a local auto servicing centre. The general manager (Jo) realises that the IT system has evolved over time with l

What is hypercube network, Q. What is Hypercube Network? The hypercube ...

Q. What is Hypercube Network? The hypercube architecture has played a significant role in development of parallel processing and is quite influential and popular. The highly sy

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd