Computer Sciences > Gate 2017 Set-1 > Compiler Design
Consider the following grammar:

stmt -> if expr then else expr; stmt | ε
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

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)...
#168 MCQ
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...
#575 Fill in the Blanks
Consider the following two sets: Constant Folding Which one of the following options is the CORRECT match from Set X to Set Y?
#909 MCQ

Related Topics

control flow paths grammar GATE computer science 2017 control flow paths if else program structure analysis relational operators grammar ternary operations gate number of control flows if then else statements gate

Unique Visitor Count

Total Unique Visitors

Loading......