Question

In: Computer Science

The syntax of a language is quite simple. The alphabet of the language is {a, b,...

The syntax of a language is quite simple. The alphabet of the language is {a, b, d, #} where # stands for a space. The grammar is
<sentence> → <word> | <sentence> # <word>
<word> → <syllable> | <syllable> <word> <syllable>
<syllable> → <plosive> | <plosive> <stop> | a <plosive> | a <stop>
<plosive> → <stop> a
<stop> → b | d

Which of the following speakers is an imposter? An impostor does not follow the rules of the language.
a: ba#ababadada#bad#dabbada Chimp:

b: abdabaadab#ada
c: Baboon: dad#ad#abaadad#badadbaad

Solutions

Expert Solution

Option c is an imposter since it does not follow the rule of given grammar.

Explanation : Look at the figure, from the given language, the grammar can be derived. Whereas in part a grammar can be derived. Whereas c is the only part in which imposter is unable to solve the grammar.

Thus, part c is the solution.


Related Solutions

The syntax of the monkey languages is quite simple, yet only monkeys can speak it without...
The syntax of the monkey languages is quite simple, yet only monkeys can speak it without making mistakes. The alphabet of the language is {a, b, d, #}, where # stands or a space. The grammar is <stop> ::= b|d <plosive> ::= <stop>a <syllable> ::= <plosive>|<plosive><stop>|a<plosive>|a<stop> <word> ::= <syllable>|<syllable><word><syllable> <sentence> ::= <word>|<sentence>#<word> Using parse trees, which of the following speakers is the secret agent masquerading as a monkey? Chimp: abdabaadab#ada Baboon: dad#ad#abaadad#badadbaad
1. Prove the language L is not regular, over the alphabet Σ = {a, b}. L...
1. Prove the language L is not regular, over the alphabet Σ = {a, b}. L = { aib2i : i > 0} 2) Prove the language M is not regular, over the alphabet Σ = {a, b}. M = { wwR : w is an element of Σ* i.e. w is any string, and wR means the string w written in reverse}. In other words, language M is even-length palindromes.
Draw the NFA for language L2 = { w | w ends in 12}. Alphabet {0,1,2}
Draw the NFA for language L2 = { w | w ends in 12}. Alphabet {0,1,2}
Here are two sets of BNF grammars specifying the syntax of a language: <exp> ::= <term>...
Here are two sets of BNF grammars specifying the syntax of a language: <exp> ::= <term> | <term> + <exp> | <term> - <exp> <term> ::= <op> | <op> * <term> <op> ::= <int> | <id> | (<exp>) ********************************************* <exp> ::= <term> | <term> + <exp> | <term> - <exp> | (<exp>) <term> ::= <op> | <op> * <term> <op> ::= <int> | <id> <int> will lead to non-terminals of a digit or digit sequence '123' etc. <id> will lead...
3. Are the following languages A and B over the alphabet Σ = {a, b, c,...
3. Are the following languages A and B over the alphabet Σ = {a, b, c, d} regular or nonregular? • For a language that is regular, give a regular expression that defines it. • For a nonregular language, using the pumping lemma prove that it is not regular. (a) A = {d 2j+1c k+1 | j ≥ k ≥ 0} · {c r+2b 2s+3 | r ≥ 0 and s ≥ 0} (b) B = {a 2j+2b k+3c j+1...
Draw PDA transition diagram for the following language: The set of strings over the alphabet {x,...
Draw PDA transition diagram for the following language: The set of strings over the alphabet {x, y} where 2 * (# of x's) = 3 * (#y's) That is, if we let nx be the number of x's and ny be the number of y's, then the strings in these language are those where 2nx = 3ny Try to find a PDA that is as simple and elegant as possible (do not convert from CFG). ------------------------------------------------------------------------------------------------------------------ USE Notation between transition:...
Consider the language L1 over alphabet Σ = { 0, 1 } where the production rules...
Consider the language L1 over alphabet Σ = { 0, 1 } where the production rules for L1 are as follows: S → TT S → U T → 0T T → T0 T→ 1 U → 0U00 U → 1 Q → λ P → QU Transform this grammar into Chomsky Normal Form, consistent with the CNF specification in the Quick Reference, and using only Variables { S, T, U, V, W, X }. Implement that CNF grammar in...
Theory of computation: Consider the alphanumeric alphabet Σ = {a, b, . . . , z,...
Theory of computation: Consider the alphanumeric alphabet Σ = {a, b, . . . , z, A, B, . . . , Z, 0, 1, . . . , 9} and let L be the language of all regular expressions over Σ: L = {w ∈ Σ ∪ {∅,(,), ∪, ·, * }* | w is a syntactically legal regular expression over Σ} Give an unambiguous context-free grammar that generates L. The grammar should use the following precedence levels, from...
1. All questions assume the alphabet Σ = { a , b }. a) Give a...
1. All questions assume the alphabet Σ = { a , b }. a) Give a regular expression representing the language of all strings containing abab as a substring. b) Give a regular expression representing the language of all strings with an even number of a's or an odd number of b's, such as abab or baabaab. c) Give a regular expression representing the language of all strings of the form ambn, where m is even and n is odd....
Python uses indention in its program structures. How do you define the syntax of a language...
Python uses indention in its program structures. How do you define the syntax of a language construct that uses indention? Give an example to describe.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT