i need ur help in compiler construction

posted by .

Q: Given the following 3-address code

1: a = 1
2: b = 2
3: c = a + b
4: d = c - a
5: if( d < 20 ) goto 11
6: d = b * d
7: if( d > 20 ) goto 11
8: d = a + b
9: e = e + 1
10: goto 6
11: b = a + b
12: e = c - a
13: if( e < d ) goto 3
14: a = b * d
15: b = a – d



(a) What are the basic blocks for the code segment?


(b) Draw the control flow graph (CFG) for the code once you have determined the basic block.



Given the following 3-address code

1: a = 1
2: b = 2
3: c = a + b
4: d = c - a
5: if( d < 20 ) goto 11
6: d = b * d
7: if( d > 20 ) goto 11
8: d = a + b
9: e = e + 1
10: goto 6
11: b = a + b
12: e = c - a
13: if( e < d ) goto 3
14: a = b * d
15: b = a – d



(a) What are the basic blocks for the code segment?


(b) Draw the control flow graph (CFG) for the code once you have determined the basic block.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. compiler construction

    Given the following 3-address code 1: a = 1 2: b = 2 3: c = a + b 4: d = c - a 5: if( d < 20 ) goto 11 6: d = b * d 7: if( d > 20 ) goto 11 8: d = a + b 9: e = e + 1 10: goto 6 11: b = a + b 12: e = c - a 13: if( e < d ) goto …
  2. Compiler Construction

    Given the following 3-address code 1: a = 1 2: b = 2 3: c = a + b 4: d = c - a 5: if( d < 20 ) goto 11 6: d = b * d 7: if( d > 20 ) goto 11 8: d = a + b 9: e = e + 1 10: goto 6 11: b = a + b 12: e = c - a 13: if( e < d ) goto …
  3. BUS 210

    Imagine that you are starting your own company. What will be the ethical code of your company?
  4. programming

    I have just started C programming after a semester of Java. I am very new to this and the teacher has not really given much instruction so I am completely lost on what to do for this. I need to determine the decimal value f the following …
  5. Computer Information

    A __________ provides the tools that a programmer uses to create software. a)compiler b) interpreter c)code d)a programming language In a way, don't all of these help a programmer to create software?
  6. ethics

    Write a 1,750- to 2,450-word paper that formulates your personal code of ethics, using one of the major ethical frameworks as a guide. Include answers to the following questions: o In previous weeks, you examined the professional code …
  7. Computer Science

    Hi can you guys help me with these output code, I think you need to include for loops, but I'm not sure how to use it. Example code would be helpful, thanks. Produce Output For each problem, you are to produce the code, in JAva, to …
  8. medical coding

    what is the corresponding HCPCS Level II code for HCPCS Level I code 96360?
  9. Computer Literary

    Which of the following is Not an example of debugging A)Looking for errors in programming code B)Fixing misspelled commands in programming code C)Solving faulty logic in programming code D)Upgrading to improve the programming code
  10. statistics

    A zip-code is a five-digit number identifying where in the U.S. an address is located. The first four digits in a zip code can be any number 0-9, but the fifth digit cannot be 0. In addition to this, each address has a “plus-four” …

More Similar Questions