Which of the following is the correct representation of grammar for the given regular expression? a(aUb)*b

Lò Ngọc

New member
Which of the following is the correct representation of grammar for the given regular expression?
a(aUb)*b
A.
(1) S → aMb
(2) M → e
(3) M → aM
(4) M → bM
B.
(1) S → aMb
(2) M → Mab
(3) M → aM
(4) M → bM
C.
(1) S → aMb
(2) M → e
(3) M → aMb
(4) M → bMa
D. None of the mentioned
 
Answer: A
Explanation:
The basic idea of grammar formalisms is to capture the structure of string by
A. using special symbols to stand for substrings of a particular structure
B. using rules to specify how the substrings are combined to form new substrings.
 

Tìm kiếm

Back
Top