johanberntsson / PunyInform

A fast and compact library for writing text adventure games for the Z-machine running on 8-bit computers as well as other platforms.
MIT License
176 stars 17 forks source link

"Verb meta" problems with Inform 6.43 #123

Closed DavidGriffith closed 4 months ago

DavidGriffith commented 4 months ago

When I try to compile a test program using the latest PunyInform (66096d6c1b2b364d112ef289b0d8dcd4d103c94a) and the latest Inform6 compiler (https://github.com/DavidKinder/Inform6/commit/5885e84b525e757d3395f1846f5bae31131866a6) I get this:

/home/dave/proj/int-fiction/inform/inform6unix/inform-6.43 -v3 +punyinform/lib punyinform/howto/pushdir.inf punyinform/howto/pushdir.z3
Inform 6.43 for Linux (in development)
"punyinform/lib/grammar.h", line 1368: Error:  Two different verb definitions refer to "pronoun"
> Verb 'pronoun' 'pronouns'
Compiled with 1 error (no output)
make: *** [Makefile:256: punyinform/howto/pushdir.z3] Error 1

This is similar to a bug in the Standard Library which was reported at https://gitlab.com/DavidGriffith/inform6lib/-/issues/140 by @erkyrath :

"i6lib-6.12.6/infix.h", line 1169: Error:  Two different verb definitions refer to ";examine"
> Verb meta ';xo' ';examineo'
"i6lib-6.12.6/infix.h", line 1171: Error:  Two different verb definitions refer to ";examine"
> Verb meta ';xs' ';examines'

He also writes:

The dict words ';examineo' and ';examines' are the same, and this is now a compile error.

I recommend renaming these verbs to ';exo' and ';exs', as per this commit: https://github.com/erkyrath/Inform6-Testing/commit/e24fd1a4fdbd6c6afb47455a5415370744ec488f

The problem I found with PunyInform doesn't deal with infix verbs.

The following works, but I'm unsure if it's correct: If I change the line at https://github.com/johanberntsson/PunyInform/blob/master/lib/grammar.h#L1367 from Verb meta 'pronoun' 'pronouns' to Verb meta 'pronoun' will correct the compile time problem and still allow the player to type PRONOUNS and get the expected response.

erkyrath commented 4 months ago

This is a bit of a nuisance. The problem is that 'pronoun' and 'pronouns' are different verbs in V5, but the same verb in V3.

If you want PunyInform to support all Z-machine versions, it's best to write

Verb 'pronoun' * -> Pronoun;
#IFV5;
Verb 'pronouns' * -> Pronoun;
#ENDIF;

(The #IFV5 directive is badly named -- it really means "version 4 or later, or Glulx.")

fredrikr commented 4 months ago

Does this have to do with the meta flag, or can this pop up in other verbs as well?

Could the compiler detect this case (a list of synonymous verbs holds the same verb two or more times), and just ignore all occurences but the first?

johanberntsson commented 4 months ago

I've implemented the change and tested with the trunk version of Inform 6.43. Both 'pronoun' and 'pronouns' work in z3 and z5, and there are no errors.

erkyrath commented 4 months ago

Does this have to do with the meta flag

No.

Could the compiler detect this case (a list of synonymous verbs holds the same verb two or more times), and just ignore all occurences but the first?

Hm. Maybe. I'll have to look at the verb-parsing code again.