Understand adjectives/quantifiers after nouns instead of before? (toki pona)

How can I let the player type adjectives/quantifiers after nouns instead of before? “torch unlit”/“torches two” instead of “unlit torch”/“two torches”.

I’m trying to make toki pona, a very simple conlang, the language of play. I’ve rewritten most of the code on this page, so things like quantifiers and pronouns are understood, but I’m stuck on how to make the parser understand adjectives/quantifiers after nouns instead of before. (In toki pona, adjectives and quantifiers come after nouns.)

Example: “moku” means food, “tu” means two, and “jo e” roughly means “to take”. My game understands the command “jo e tu moku” as taking two foods, but that’s not correct grammar; I want it to understand “jo e moku tu” instead.

So far the best I have is some hacky text replacement in an “After reading a command” rule, but surely there’s a better solution? I looked at Spanish and French translations but I couldn’t find the part that makes this work. I tried copying Part 2.3 - Adjectives from the French translation but it didn’t do what I want.

1 Like

Following, thank you for asking!

1 Like

Inform, by default, doesn’t care about the order of words within a noun phrase. TAKE GREEN BOOK is exactly equivalent to TAKE BOOK GREEN—or TAKE BOOK BOOK GREEN BOOK GREEN GREEN GREEN, for that matter.

The idea is that accepting all valid inputs is more important than rejecting all invalid inputs, so err on the side of accepting too much instead of too little.

Quantifiers are a bit trickier. Gotta think about that.

This is true for most adjectives. But it is false for “lit” and “unlit”. Those are not handled like regular words; they’re a special case in the parser (going back to the I6 days).

This part is only to allow writing the adjectives after the noun in the source code. It has no incidence on the parser at runtime. (And I don’t remember if it still works with Inform 10.)

As the other mentioned, the parser mostly accepts any order of adjectives and nouns.

I believe the hacky text replacement to make the command have a more English word order is the proper way (or at least the easiest). Except the best practice (at least as of 6L38, I’m not fully up to date) is, for several reasons, to write an Inform 6/Inter LanguageToInformese routine for that instead of using an after reading a command rule.

1 Like