anonymous
  • anonymous
2. Give a finite state machine that defines the language of all “words” using only lower case letters that contain your first name repeated one or more times with exactly two letters (a–z) between each occurrence of your name. For example, words in my language would be: “jim”, “jimaajim”, “jimabjim”, “jimtwjim”, “jimrrjimopjim”, etc.
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
# lang: seed with base name used in the language # chars: all possibly character combinations desired between each name # maxlength: the maximum number of characters per word in the dictionary def defineLang(lang, chars, maxlength): count = 0 genlength = len(lang[0])+2 while (len(lang[-1])+genlength) < maxlength: for word in lang[-count:]: for c in chars: lang.append(word+c+lang[0]) count += genlength return lang def createMix(n): charmix = [] #create the mix of all possible 2 letter combinations for a in range(n): a_ch = chr(97+a) for b in range(n): charmix.append(a_ch+chr(97+b)) return charmix print defineLang(["Corbin"],createMix(26),15) This is very close to working, but it has a problem with some duplicate results. As far as I can tell I think the only duplicates are with the first {name}{chars}{name}. I'm probably overlooking a stupid mistake. I'll come back and work on it more later if no one else has any suggestions.
anonymous
  • anonymous
oh by the way, that is in python
anonymous
  • anonymous
Isn't a finite state machine one that either accepts or rejects an input based on the grammar? I would write a recursive function: if input == : return true if the start of the input is : recurse with else return false

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
What do you need to write when you are asked for finite state machine? Do you mean something like DFA or NFA? or program?
anonymous
  • anonymous
That's a very good question. And it depends on Tektronix' assignment. But all automata are pretty much the same, in theory. Whether it's a state diagram, a BNF description of the language, a computer program or script to simulate it, or if you still have a paper tape reader/writer and soldering iron....

Looking for something else?

Not the answer you are looking for? Search for more explanations.