Question: Give a CFG that will work for the procedures below and any other procedures that has the same kind of instructions. PROCEDURE multiply a, b;

Give a CFG that will work for the procedures below and any other procedures that has the same kind of instructions.

PROCEDURE multiply a, b VAR a, b,z; BEGIN ZA= 0; WHILE b > 0 DO BEGIN ZA = a + z; END RETURN z; END PROCEDURE odd x, VAR X BEGIN WHILE x > 1 DOx:-x/2; F x- 1 THEN RETURN 1 ELSE RETURN ; END 

PROCEDURE multiply a, b; VAR a, b, z; BEGIN 0; WHILE b> 0 DO BEGIN -a+z; b= b - 1; END RETURN z; END; PROCEDURE odd x; VAR x; BEGIN WHILE x > 1 D0 x:= x/2; IF x = 1 THEN RETURN 1; ELSE RETURN 0; END;

Step by Step Solution

3.49 Rating (166 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!