Grammar order for verb SHOW

Perhaps the order of the grammar could be inverted for the verb SHOW:

Verb 'show' 'display' 'present'
	* creature held      -> Show reverse
	* held 'to' creature -> Show;

> show apple
You can only do that to something animate.

> show apple to monster
The monster doesn’t seem interested.

Verb 'show' 'display' 'present'
	* held 'to' creature -> Show
	* creature held      -> Show reverse;

> show apple
I think you wanted to say “show apple to someone”. Please try again.

> show apple to monster
The monster doesn’t seem interested.

It seems obvious, but you have to be careful with all the possible syntaxes and also with the pronouns.
I think @Warrigal must have an advice about this.

This is the same grammar as the Inform 6 standard library. Only the default responses are different. I don’t think the order of the grammar rules matters in this case, as they can’t be ambiguous. One response that you left out is:

> show monster
I think you wanted to say "show monster something". Please try again.

I think these are all reasonable responses.

If you wanted SHOW OBJECT to be a legitimate input (such as with a verb + noun game), you would need to extend the grammar and do your own implicit actions. This is pretty easy to do.

I don’t think this has to do with order. The parser tries all lines, unless it finds a perfect match. When it doesn’t find a perfect match, it assumes the match with the highest score is what you mean.

I think the score formula may be incorrect here. If you’re holding the apple, the held token is certainly a better match than the animate token. Even if you’re not holding it, one could argue that held is better, since you can make it held with an implicit take.

Will get back to you on this.

This has now been fixed in PunyInform. It will work properly in the next release.

2 Likes