0

I want to, for each of the following languages on Τ={a, b, c}, construct the corresponding regular expression and regular grammar:

  • All strings containing exactly three a’s.
  • All strings containing at most three b’s.

How can I do this?

icktoofay
  • 126,289
  • 21
  • 250
  • 231
  • 3
    Your question _is_ off, not so much because of the topic (although it might be better suited at [Computer Science](http://cs.stackexchange.com/)), but because this is not a site where people do your homework for you. You need to show that you have made some effort, and explain what you have done and where you are stuck. – Aasmund Eldhuset Sep 15 '14 at 21:36
  • yes, i was just looking for a starting point. Or what is it asking for as i am unclear. – bigpoppipop Sep 15 '14 at 21:42
  • 1
    What have you tried so far? I'd be happy to help out with this, but you need to demonstrate an effort first. – templatetypedef Sep 15 '14 at 21:47
  • 1
    @bigpoppipop: The question is clear and understandable to anyone who knows automata theory (after all, it seems to be a copy of an assignment text, which tend to be very precisely worded), but if you are looking for a starting point, you should say so, and describe what you already know. Do you understand how concatenations, unions and Kleene stars work? – Aasmund Eldhuset Sep 15 '14 at 21:50
  • Its not necessary homework but review for my quiz. I just don't get how i can construct a expression/grammar give just T={a,b,c} – bigpoppipop Sep 15 '14 at 21:52

1 Answers1

1

You may always use unions, concatenations and Kleene stars in addition to the given symbols (unless the task explicitly forbids it). So if you don't know how those work, read up on those first. Afterwards, here's a hint to the first task: take any string that contains three or more b's, say, acbaacbbaacbacb. Each character is either one of the first three b's or not: xxbxxxbbxxxxxxx. So the structure of such a string is a sequence of any characters (or maybe none if it starts with a b), and then a b, then more other characters (maybe), then another b, more characters (maybe), the third b, and finally more characters (maybe). How do you express "any character", and how do you express the alternating sequence of b's and "any character, zero or more times"?

Aasmund Eldhuset
  • 37,289
  • 4
  • 68
  • 81