COMPILER DESIGN

SYNTAX ANALYSIS

CONTEXT FREE GRAMMARS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Given grammar G:(1)S
A
2, 4
B
1, 3
C
1, 2, 3, 4
D
2, 3, 4
Explanation: 

Detailed explanation-1: -The production rules of Grammar G1 satisfy the rules specified for CNF, so the grammar G1 is in CNF. However, the production rule of Grammar G2 does not satisfy the rules specified for CNF as S → aZ contains terminal followed by non-terminal. So the grammar G2 is not in CNF.

Detailed explanation-2: -Definition: A CFG is in Chomsky normal form if and only if all production rules are of the form A → BC or A → x with variables A, B, C∈V and x∈T.

There is 1 question to complete.