Nitku’s example is especially important, and it’s one of the things I always got wrong in homebrew IF. It’s easy to check an input line for known words, and then match this up against a preset list of known actions. For instance, if the first word is “get” or “take” and the word “jacket” is contained inside the input, then run code for picking up the jacket. But what happens when the player wants to “take off jacket” or you’ve also included a bee (intended as pure scenery) and the player is trying to “get yellowjacket?”
What this alludes to is an underlying object model, in which everything in the game (aside from pure scenery, which should still react to basic commands) is an “object” with properties such as whether or not it’s a container, a platform, something that can be used to tie other things together (i.e., a rope or string), something sharp, something that provides a light source, and so on. Then comes the even harder part – building a parser that doesn’t check specific words against a list of possible commands, but is built as grammar rules. In other words, something to the effect of “get/take/pick up [object]” and the parser compares known objects against the input.
But believe me, this is difficult to get right. I started working on a home-brew .NET game for IFComp '09, originally intended as a joke. I wanted the parser to be good though – I mean, good enough to avoid the two-word-parser syndrome, handle objects like described above, parse the right way, etc. I spent quite a few hours on it, and eventually just ran out of time and motivation. It’s pretty interesting, though. It handles some complex concepts, including object disambiguation and grammar rules (based on my experiences with the Hugo IF language). It handled attributes, etc. Not sure I got around to pronouns (i.e., “get it” after doing “x rock”), but it was on the to-do list.
At the end, I decided it was too much effort for a joke entry, and that if I really wanted to code something, I should write a Hugo runner native to .NET. Of course, I’ve done no such thing (I’m lazy), but I did decide that writing a homebrew parser the “right” way just doesn’t seem worth it.