SICP Exercise 4.47

SICP Exercise 4.47

It does not work correctly even for the most simple sentences such as “the professor lectures”. For the above sentence, the parser can produce the correct result when it runs for the first time. But if one runs try-again, it will be stuck in an infinite loop because the evaluation of (parse-prepositional-phrase) always fails. The failure will cause the evaluation of (list 'verb-phrase (parse-verb-phrase) (parse-prepositional-phrase)), which in turn will cause the the evaluation of (parse-prepositional-phrase) again. Moreover, if the sentence contains a misspelled word, the parser will be stuck too.

Changing the order of expressions in the amb would make things even worse. It would fail for the above simple sentence even in the first round.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.