Question
Consider the following regular expressions: R1 = b+c+d+e+f R2 = a+b+c+d+e+f R3 = (a* +b* )(a+b) R4 = (a+b)* R1 (a+b) R5 = a.a R0
Consider the following regular expressions:
R1 = b+c+d+e+f
R2 = a+b+c+d+e+f
R3 = (a* +b* )(a+b)
R4 = (a+b)* R1 (a+b)
R5 = a.a R0 * (a+b)*
R6 = R3 * R2 * a.a.a
Let getToken() be a function that returns the next token in the input. If its called repeatedly it will return one token after another. When all the input is consumed, geToken() returns EOF (end of file). Assume that longest prefix-matching rule is used, also assume that ties are broken in favor of the regular expression listed first in the list.
- Give an example of input for which getToken() returns R0
- Give an example of input for which getToken() returns R1
- Give an example of input for which getToken() returns R2
- Give an example of input for which getToken() returns R3
- Give an example of input for which getToken() returns R4
- Give an example of input for which getToken() returns R5
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started