A Grammar to Parse Simple Sentences?
3. A game supports text input, allowing you to give commands to your character. Assuming that
basic word types (such as nouns and verbs) are defined and recognised, write a grammar
that would parse simple sentences such as:
“jump”
“rub lamp”
“take the sword”
“say ‘hello’”
“go north”
“steal the coin and hide it”
“shout ‘BOO!’ then laugh”
Can anyone help me with this??? Thanks :S
Comments
First, you will have probably five word types:
1) CONJUNCTION (and, then)
2) VERB (rub, jump, go)
3) OBJECT (lamp, sword, north, it)
4) LITERAL (boo, hello)
5) IGNORE (the)
Then you will need to define what constitutes a legal sentence. In the simple grammar show, there are only five types of sentences:
1) VERB (jump)
2) VERB OBJECT (go north, rub lamp)
3) VERB 'LITERAL' (say 'hello')
4) VERB IGNORE OBJECT (take the sword)
5) SENTENCE CONJUNCTION SENTENCE (steal the coin and hide it)
Notice that all the examples fall into one of these categories. So that's pretty much it.
that is incredibly not a complicated question. The verb is "could have been." "Been" is the considerable verb, and it incredibly is a linking verb, so there is not any question approximately that. "could have been" because of the fact the verb word is a linking verb. This use of "could" exhibits an assumption, and it incredibly is unquestionably a modal auxiliary. The "have" is the auxiliary verb we use to point previous modals. "Be" (and "been") will consistently be linking verbs. "could" and "have" are auxiliaries.