COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Regular expression (a|b)* denotes
A
One or more occurrences of a or b
B
One or more occurrences of a and b
C
Zero or more occurrences of a or b
D
Zero or more occurrences of a and b
Explanation: 

Detailed explanation-1: -a*b* corresponds to the set of strings consisting of zero or more a’s followed by zero or more b’s. a*b+a* corresponds to the set of strings consisting of zero or more a’s followed by one or more b’s followed by zero or more a’s.

Detailed explanation-2: -A regular expression followed by a question mark ( ? ) matches zero or one occurrence of the one-character regular expression. So to match any series of zero or more characters, use “ . * “.

Detailed explanation-3: -Solution: As we know, any number of a’s means a* any number of b’s means b*, any number of c’s means c*. Since as given in problem statement, b’s appear after a’s and c’s appear after b’s. So the regular expression could be: R = a* b* c*

There is 1 question to complete.