Concepts Of Programming Languages ISBN-13: 978-0-13-394302=3 1. The syntax of a
ID: 3875905 • Letter: C
Question
Concepts Of Programming Languages
ISBN-13: 978-0-13-394302=3
1. 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
Explanation / Answer
Solution:
a)
ba#ababadada#bad#dabbada is not generated from the grammar given above, so we can say that the Chimp is an imposter.
Because if you observe the given string in the last there is dabbada which needs to be generated from the word.
the word will give us <syllable> <word> <syllable>
through which we can drive <plosive> | <plosive> <stop> | a <plosive> | a <stop>
and <plosive> will always drive <stop> a
which means there is neve two consicutive b's in the language.
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.