The Gateway to Computer Science Excellence
+1 vote
110 views

someone please share detailed rules for this along with solution- would be of great help.

and we usually dont take start and end state- arent they extra here? coz count comes different

 

in Compiler Design by Junior (667 points)
edited by | 110 views
0
Yes start and end states need to be counted. Do you have any specific doubt? Given solution looks correct to me

1 Answer

0 votes

In order to form control flow graph we must form basic blocks of instructions and assign edges in between them to show the flow of program as per condition met.Some rules to form basic blocks:

1.start and end blocks are added to show beginning and ending of data flow .

2. first statement is always a beginning of new block.

3. goto expression(conditional/ unconditional branching) pointing to any statement, form a new basic block starting with respective target statement no.

4. statement that follows immediately a conditional/ unconditional expression reflects beginning of new block.

The solutions must have 8 ans as per these rules. Please find below image for solution:

 

by Junior (501 points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,647 questions
56,492 answers
195,439 comments
100,706 users