ISRO Scientist/Engineer CSE 2020Compiler Design › Parsing
ISRO Scientist/Engineer CSE 2020 PYQ: A grammar is defined as $A \rightarrow BC$ $B \rightarrow x \mid Bx$ $C \rightarrow B \mid D$ $D \rightarrow…
A grammar is defined as
- $A \rightarrow BC$
- $B \rightarrow x \mid Bx$
- $C \rightarrow B \mid D$
- $D \rightarrow y \mid Ey$
- $E \rightarrow z$
The non terminal alphabet of the grammar is
- A$\{A,B,C,D,E\}$Correct answer
- B$\{B,C,D,E\}$
- C$\{A,B,C,D,E,x,y,z\}$
- D$\{x,y,z\}$
Answer
(A) $\{A,B,C,D,E\}$
Approach
Identify the non-terminal symbols as the capital letters appearing on the left-hand side of the production rules. Terminals are the lowercase symbols that appear only on the right-hand side.
Reviewed by ISRO IQ Editorial Team.