1. Consider a language of words, where each word is a string of dots and dashes.
ID: 3544659 • Letter: 1
Question
1. Consider a language of words, where each word is a string of dots and dashes. The following grammar describes this language:
<word> = <dot>|<dash><word>|<word> <dot>
<dot> =
<dash> = --
a. Write all three-character strings that are in this language.
b. Is the string ???? - - in this language? Explain
c. Write a seven-character string that contains more dashes than dots and is in the language. Show how you know that your answer is correct.
d. Write pseudocode for a recursive recognition function isIn(str) that returns true if the string str is in this language and returns false otherwise.
Explanation / Answer
,
Consider L as a language,
L = {<dot><dot><dot>,
<dash><dash><dot>,
<dot><dash><dot>,
<dash><dot><dot>}
For your question B
in this Lang. "....--" can't possible.. because each <word> is have to end with the <dot>.
I can give u explanation, whenever u create a word like <dash><word> u have to put something in place of <word> which is not possible without ending of <dot>
For ques. C
L={<dash><dash><dash><dash><dot><dot><
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.