One of the first things that got me into wanting to program was to create a multiplayer text game. I was scared away from the notion though when I realized, at least at the time for me, how complicated writing a smart parser would be.
So now I'm back to thinking about it, and I've tried to do lots of research on the subject. It turns out that it seems to be a lot more involved than I think, and I've stumbled across terms such as lexing and tokenizing and parsing, only the latter of which I knew of before. I figured the field of lexical analysis is what I wanted to look for.
So instead of trying to create my own lexer and parser which I've read to be very difficult and error prone, and most people instruct to steer away from, I thought I would find a good lexer and parser generator to use which will supposedly do all the heavy lifting for me and I can just focus on the grammar that I want. I've also heard lots of people say that individuals looking to do such a thing should simply use Inform
.
Sure, I guess Inform is cool, but C# is my language of choice and I like the freedom that it allows me over what I perceive Inform to offer. I'm more interested in creating all the components and framework of the multiplayer text game than I am in any one particular final result, and so I like the idea of using a standard programming language best.
I've been trying to find a good lexer/parser generator for C# for a while now, not really satisfied with all that seems to be offered in terms of the comments people give.
antlr for C# seems to be underdeveloped and mostly an afterthought. I've tried understanding GPLEX and GPPG but as of right now they are far too confusing for me, despite reading a lot of the documentation and trying to read up a lot on lexing in general.
I have a lot of the concepts in my head about the whole process of lexing, but when faced with a lexer and a parser, I guess I don't really know how these are supposed to be meshed into my actual code.
I want to build a simple English like grammar with noun phrases and verb phrases, and be able to have lists of nouns and verbs that can be dynamically added and ready from a database as the game is developed and expanded upon.
I guess I'm feeling like I'm turning up short on the results of the research I've been trying to do with this subject.
To be honest, the idea of creating my own bastardized notion of a lexer and parser based on what I've researched seems far more appealing at this point than using any lexer/parser generator that I've read about.