Problem 3 on Page 328 of Programming Languages by Pratt, Second Edition

Problem 3 on Page 328 of Programming Languages by Pratt, Second Edition

<p> Homework Assignment - Programming Languages - Professor Adams Assigned 2/23/04 – due 2/28/04 Name:______Score ______</p><p>The syntax of the monkey language is quite simple, yet only monkeys can speak it without making mistakes. The alphabet of the language is {a,b,d,^}, where ^ stands for a space. The grammar is</p><p><stop> ::= b | d <plosive> ::= <stop> a <syllable> ::= <plosive>| <plosive <stop> | a <plosive> | a <stop> <word> ::= <syllable> | <syllable> <word> <syllable> <sentence> ::= <word> | <sentence> ^ <word></p><p>Which of the following speakers is the secret agent in monkey disguise? ______</p><p>Ape: ba ^ ababadada ^ bad ^ dabbada Chimp: abdabaadab ^ ada Baboon: dad ^ ad ^ abaadad ^ badadbaad</p><p>HINT: You should try to construct a parse tree that works to solve this problem! When you have come up with a solution, copy the parse tree to the space below.</p><p>WARNING: It is time consuming</p><p> filename: monkey.hw</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    1 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us