Computer Sciences > Gate 2017 Set-1 > Compiler Design
Consider the following grammar:
where relop is a relational operate (e.g < >, ….), ε refers to the empty statement, and if ,then, else are terminals. Consider a program P following the above grammar containing ten if terminals. The number of control flows paths in P is ____________. For example, the program
has 2 control flow paths, e1 -> e2 and e1 -> e3
stmt -> if expr then else expr; stmt | ε
expr -> term relop term | term
term -> id | number
id -> a | b | c
number -> [0-9]
expr -> term relop term | term
term -> id | number
id -> a | b | c
number -> [0-9]
where relop is a relational operate (e.g < >, ….), ε refers to the empty statement, and if ,then, else are terminals. Consider a program P following the above grammar containing ten if terminals. The number of control flows paths in P is ____________. For example, the program
if e1 then
e2
else
e3
e2
else
e3
has 2 control flow paths, e1 -> e2 and e1 -> e3
Correct : a
Similar Questions
Match the following according to input(from the left column) to the compiler phase(in the right column) that process it:
(P)Syntax Tree
(i)...
Consider the following code segment.
x = u - t;
y = x * v;
x = y + w;
y = t - z;
y = x * y;
The minimum number of total variables required to convert the abo...
Consider the following two sets:
Constant Folding Which one of the following options is the CORRECT match from Set X to Set Y?
Total Unique Visitors
Loading......