Processing Parsed Commands

After parsing, one can use either object-subject-verb or verb-subject-object to sequentially process the parsed command given by user.
The first model won’t be able to understand “KILL TROLL AND ORC WITH SWORD AND HAMMER R (=respectively)” and yet Infocom used it in ZIL. Does the second model has any inherent flaws because of which it is not used? Can you give some example? Or is it just a convenient convention?

When you say subject in this case do you mean indirect object (SWORD or HAMMER in your example)? The subject is generally assumed to be the player character.

I think it would be possible to set up something like that in a direct-indirect-verb system: put the list of direct objects in a list, then if the word “respectively” is found try to match them against the parsed list of indirect objects.

In above example (">" indicates indentation):

Verb=KILL

SUBJECT 1= TROLL

OBJECT 1= SWORD
SUBJECT2= ORC
OBJECT 2= HAMMER

If the optional R had been missing:

VERB=KILL

SUBJECT 1= TROLL

OBJECT 1= SWORD
OBJECT 2= HAMMER
SUBJECT2= ORC
OBJECT 1= SWORD
OBJECT 2= HAMMER

Imperative clauses don’t have expressed subjects. So I don’t really understand what you’re asking.

Is there any particular profit in using indirect-direct-verb system?
I didn’t knew of the standard terminology and so made my own in which subject means direct, object means indirect and me means subject.

If I understand what you mean by “verb-subject-object”, it is simply that the type and number of objects is dependent on the verb. (“inventory” -> no objects at all, “get” -> list of objects, “attack” -> exactly two objects, “say” -> arbitrary words, etc.) So you start by looking at the verb and work from there. Inform has developed this model in depth, obviously.

ZIL was able to handle “turn left handle and right handle” (Bureaucracy) and even “Waldo and Auda, lift weight”. I imagine those were special-cased up the wazoo, though.

EDITED: Something like that. Basically, when the command “KILL TROLL AND ORC WITH SWORD AND HAMMER” is given, the machine will understand it as following (I’m using cons cell for representation):

(kill . (troll . (sword hammer)) . (orc . (sword hammer)))

The both nils in '(sword hammer) sends control back to machine (so that real time mechanics may be implemented, if the author wants to).

EDIT1: Above representation in when R will be missing. If there is R, the representation is

(kill . (troll . (sword)).(orc . (hammer)))

But “KILL TROLL AND ORC WITH SWORD AND HAMMER” is bad English to start with. Yes it makes sense, but it’s very unnatural.

Umm, what can I say? Here I am, punching paranthesis after paranthesis in my hard drive and you are trolling me with grammar? I not Graham Nelson, man; and me ain’t know how g-word no working. Anyway, HELP KILL sounds more unnatural, doesn’t it? And KILL TROLL AND ORC WITH SWORD AND HAMMER are less keystrokes than KILL TROLL WITH SWORD AND KILL TROLL WITH HAMMER IN SAME TURN, THEN RETURN CONTROL TO MACHINE, THEN KILL ORC WITH SWORD AND KILL ORC WITH HAMMER. Kidding, just kidding; i ain’t no any trolls.

Long sentences are not only boring to type as they’re also more prone to errors, requiring thus more typing. Thus, two word commands are the standard, specially on mobile. Attack troll with what? Silence

When you have no idea what you are talking about, it’s advisable to be silent. How am I missing the Indirect Object, may I ask?

Naman Dixit, are you saying that ZIL actually understands “KILL TROLL AND ORC WITH SWORD AND HAMMER R”? Or are you saying that you would like to be able to understand that?

In Inform 7, the basic limitation is that you can’t use more than one multiple-objects token, because there’s only one multiple object list – the list of objects understood by a “[things]” token. (You can in fact specify more than one and it’ll compile, but it won’t work when you try to use it. I’ve filed a bug about this; thanks for bringing it to my attention.) I suspect that a reasonably competent I6 hacker, which I am not, would be able to modify the I7 parser so that multiple “[things]” tokens works, by creating a second multiple object list. Then it would be reasonably easy to make the “respectively” token work; when a command ends in “respectively,” check that your two multiple object lists match in length, and repeat through them applying the first item in the first list to the first item in the second list, etc.

I can’t speak to what you want to do in your system, except that I can’t see how changing the order of parsing would help you at all in processing the “respectively” command. In order for “respectively” to work your two lists have to match in length (how would you process “Kill troll and orc with hammer, axe, and sword, respectively”?) so you’ll have to process them first. And if you really want to allow these “respectively” options for every command in the game… well, gosh, I guess you can do that if you want. My proposed I6/I7 solution would involve programming in a new understand line for every verb that could take “respectively” so I guess that’s a way in which processing the verbs last could help, if you want to do that. Though as zarf pointed out there may not be much point in trying to process the nouns before the verbs when it’s the verbs that tell you how many nouns to expect.

In any case, the use case you’re describing where someone would want to attack two different monsters in one turn with different weapons and the computer could process it in real time is pretttty far from what most people have tried to do with Inform, so that’s probably why it hasn’t come up. (Not that I wish to discourage you from doing what you want just because it’s far from what people have tried before.)

It doesn’t. I want it to.

(kill.(troll.(hammer)).(orc.(axe)).(nil.(sword)))
The number of weapons one can weild will obviously be decided number of hands, so any excess weapons will be merely consed with nil which will return execution back to machine (2 times consecutively, if you notice) and it will automatically, after the execution of previous weapons obviously, return an error.

No, the whole reason I’m creating a system is that nothing is compulsory, not even rooms. So it’ll depend upon the author if he/she wants support for R and if yes, then in how many commands.

You are misunderstanding. ZIL process Indirect Object first. I want to process verbs first. I think zarf was saying that my system makes more sense (I may be mistaken though)

It might be helpful to implement RPG like mechanics. Two weapon hit may mean greater attack but less accuracy and such.

Ofcourse not. Constructive criticism is always welcome.

Ahh, I think I see. Well, Inform 7 basically process the verb first, I think (if I’m not mistaken it matches the verb and looks for various templates that go with that verb), so there’s definitely no fatal problem in doing verb-object-indirect object parsing. In fact the Inform approach allows for reversing the two nouns, so that if you define appropriate templates with understand lines it can understand “GIVE TROLL COIN” or “GIVE COIN TO TROLL.”

I can’t really tell you anything about ZIL and less about how to design your own parser – it’s very challenging.

I think one thing Dannii is getting at is that “KILL TROLL WITH SWORD AND ORC WITH HAMMER” is more natural than using “respectively,” but I doubt you really want to get into that. We’re talking some pretty serious edge cases.

I don’t think so, although I’ve never looked into the details. It started with the verb, as far as I know.

Modern IF systems all start with the verb, basically because they’re all built to imitate and then extend what ZIL did.

I think I know his source on this: Meretzky commented on the Infocom Bugs List entry for “DUNGEON MASTER, KILL ME WITH THE STAFF” in Zork III (which causes a series of strange outputs).

Interesting! Thanks.

So if I’m reading that correctly:

The parser, which turns the typed commands into references to objects, verbs, etc., works from left to right as we’d expect.

But then the action-handling code checks the indirect object first, then the direct object, then the verb.

So there is a “me” routine that got called when the game was processing “kill troll with me.” But the routine would catch any case where the verb was “kill” and process it as “kill me,” because the routine itself didn’t tell you whether “me” was the direct or indirect object, and the imps forgot to write the check in.

That looks correct.

I think ND is implicitly talking about a stage of the parsing process, rather than action handling. Taking the word (or grammar) list and producing an action data structure. I don’t mean to sweat the labelling, but it may be misleading to assume that “verb first” or “object first” must describe the entire parsing pipeline.

I may be hung up on the Inform model where ultimately multiple-object commands resolve into a bunch of single-object commands (unless you do a hack involving the multiple object list).