Question

3. Create a CFG describing regular expressions over the alphabet {0, 1}. You will need to quote the regular expression operators and the template given you has them quoted as terminals. We expect the...

3. Create a CFG describing regular expressions over the alphabet {0, 1}. You will need to quote the regular expression operators and the template given you has them quoted as terminals. We expect the grammar to generate the following syntactic constructions:

• Union via "|", for example, 0 1 "|" 1 should be in the language generated by the grammar

• Intersection via "&", for example, 0 1 "&" 1 should be in the language

• Concatenation: any nonempty sequence of regular expressions should be in the language

• The empty string, which is denoted with the terminal e. For example, 0 "|" e should be in the language

• Parentheses: for example, "(" 0 1 ")" should be in the language • Kleene star: for example, "(" 0 1 ")" "*" should be in the language

• Complement: for example, "-" "(" 0 "*" ")" should be in the language

0 0
Add a comment Improve this question Transcribed image text
Answer #1

We generate CFG describing regular expressions over {0,1}.

Let the generating symbol be S

(i) Basic alphabets like 0,1,e => S \rightarrow 0 | 1|e

(ii) Union   => S \rightarrow S "|"S

(iii) Intersection =>   S \rightarrow S "&"  S

(iv) Concatenation =>  S → SS

(v) Parentheses =>   S \rightarrow "("S")"

(vi) Kleene Star =>   S \rightarrow S^{"*"}

(vii) Compliment => S \rightarrow "-" S

Add a comment
Know the answer?
Add Answer to:
3. Create a CFG describing regular expressions over the alphabet {0, 1}. You will need to quote the regular expression operators and the template given you has them quoted as terminals. We expect the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT