Hi all,
Since I still try to come to grips with writing IF, I guess quite naturally I find myself every now and then frustrated and run into dead ends with compilers, and begin to think to myself, “I could do this better!” (No, I’m not seriously in the stage of trying this.)
Then your mind begins to wander, and you start to think how you would go on about it. One problem is, that a decent IF compiler must have a more or less complete programming language “in its belly”. After all, what good is the IF, if you can’t perform at least some calculations, and if you don’t have functions, variable, blocks of code, etc.? That’s a lot of effort which only indirectly has to do with the IF problem at hand.
Then it dawned on me that perhaps one wouldn’t have to reinvent the wheel. After all, whatever language I used to write the IF compiler in, this compiler would have all the functionality already inside itself. So, whereas the current process is “Use language A to write your IF language compiler B, then use B to process a source file for your IF into a story file”, wouldn’t the next logical step be to reverse the roles? In other words, whoever writes a game with this system, simply writes a program in language A, includes the libraries with the actual IF functionality (parser, etc.), and then compiles it all together? (Of course, in this case there wouldn’t be a seperate IF compiler to produce a story file, and an interpreter to run it, but game source and If library would be bound together as a single executable.)
Of course, this would be tricky, because language A would have to be powerful enough to allow variable argument lists, etc. etc, but at the same time simple enough for the IF author to learn who has at the same time to invest in learning the library (the IF system proper) as well.
I’m just wondering, has anybody tried this? With what success?
Cheers,
syzygy