I can program in C or Visual Basic, and I am looking for a simple example for an IF parser. The examples don’t have to be code in any language, but that could be useful also. So pseudo code is fine.
I tried Google and found some discussions, but they are usually to random discussion threads which makes it very disorganized.
I don’t have any experience with this, so I am not sure where to start processing my tokenized words.
Looking for a very easy, gradual incline of information. Please don’t attack me with computer science!
The skotos articles and the one at Richard Bartle’s homepage itself are very thorough. Also there’s one in rec.arts.int-fiction at google groups that explains it well.
This is a tough question because a simple IF parser is very simple, and a well-developed one is kind of a nightmare! And we usually stick to the well-developed ones in these parts – for obvious reasons. I don’t know what simple ones I’d point you to. (The BASIC parser I wrote as a teenager, maybe… but that’s not posted anywhere useful.)
I guess you could start with the earliest extant Inform 5 library, although I suspect that’s already pretty complicated.
The way all of these things start (at least in English!) is to look at the first word. Boom, that’s your verb. The verb tells you whether the next item is a noun phrase (“take GREEN STONE”), a fixed word (“switch ON lamp”) or a mandatory end-of-input (“inventory”). Work from there.
Once you’ve got that working, you start thinking about accepting different patterns that might come after a particular verb. (“GET UP”, “GET STONE”, “GET IN CAR”)