Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

pyhthon question! please show step! The course notes define a simple grammar for

ID: 3664589 • Letter: P

Question

pyhthon question!

please show step!

The course notes define a simple grammar for English; one of the rules is: Extend that rule to allow sentences with prepositions, like: Kevin eats a banana in the lab The new rules are as follows: a verbphrase is a verb, optionally followed by a nounphrase, and optionally followed by a prepphrase (prepositional phrase). A prepphrase is a preposition followed by a nounphrase. Prepositions are "in" and "after". The new rules are as follows: A nounphrase is a singlenounphrase followed by zero to more conjunctivenounphrase. A conjunctivenounphrase is a conjunction followed by a singlenounphrase. Conjunctions are "and" and "or" (Note that in mathematics, A is a conjunction and V is a disjunction.) A singlenounphrase is a propernoun or a determiner followed by a noun (same as nounphrase above). Nouns are "banana", "apple", "technician", and "guard". Verbs are "eat", "eats", "run", "runs". (Note that the rules do not enforce that the singular and plural forms of the noun phrase and the verb match.) Put a the grammar from the course notes with the modifications (a) and (b) in the file B3_yourmacid. pdf or B3_yourmacid.doc (x).

Explanation / Answer

a) verbphrase::=Verb [nounphrase][prephrase]
     prephrase::=preposition nounphrase
     preposition::=in | after

b)

the new rules:
nounphrase::=singlenounphrase [conjunctivenounphrase]
conjunctivenounphrase::=     conjunctivenounphrase
           |conjunctivenounphrase[conjunctivenounphrase]
                                           |conjunction singlenounphrase
singlenounphrase::=popernoun |determiner Noun
conjunction::= and | or
Nouns=::=banana |apple |technician |guard
Verb::=eat | eats | run | runs