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!
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.
There’s also an annotated reimplementation of the (current) Inform 7 parser: inform7.com/extensions/Ron%20New … index.html
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”)
Thanks, I think that is plenty for me to get started. Since I posted my question, I also found a big list on ifwiki.org.