Grammars and Regular Expressions a) Design a grammar which generates the language: { (a |b)2 n cn |

Grammars and Regular Expressions a) Design a grammar which generates the language: { (a |b)2
ncn |
n is a positiveinteger }

Example: abc, bbbbcc, abaabbccc b) Design a grammar which generates the language which iscomposed of substrings of either 0s and 2s or 0s and 3s, and thesubstrings are divided by 1s. A substring can be empty. (What isnot allowed is substrings with 2s next to substrings with 3swithout a 1 separator.)

Example: 02, 02120, 03310211

Not allowed: 02003 c) Write a regular expression (using only the constructs thatare part of the formal definition of a regular expression) whichmatches only strings composed of 0s and 1s that have both 000 and111 in them (in any order). . . .

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *