Compiler Series: Introduction
I previously mentioned my interest in a technique for developing a language parser in C#, an interest that has now led to me working on what will be the third implementation of the Card Game Language (CGL). Presently, I have a more or less working compiler that can turn the language into an object model but there is still plenty of work left. Instead of just implementing the compiler and hiding it away in an app, I'm going to try to turn the project into a series of articles explaining the basic principles and most interesting aspects of the implementation. This both serves to educate others as well as forcing me to reflect upon my work and be a bit more thorough in my design efforts.
As with the previous CGL implementation, I'm working towards three specific end products:
- An improved version of the CGL
- A Silverlight environment for executing CGL games
- An environment for writing CGL code (Either a Silverlight application or something else)
While one of the motivations for the project is simply because its fun, there are a couple of goals I have in mind:
- Being able to easily change the language, both for the current implementation but also for future work
- Make the language simpler, more streamlined and more intuitive (facilitated by the point above)
- A richer development experience though intelligent error messages, syntax highlighting and other improvements possible when reimplementing the compiler for the bottom up
- Fewer runtime errors due to compile-time type checking
- Improved performance (this isn't really needed, but a very nice bonus we get for free)
- A reusable tool set for developing future language parsers
- A more polished game experience
It should be clear that there are a lot of benefits to this new implementation, but also that most of them are to the advantage of the developer and not the players. As the last point states, I plan on polishing up the game graphics and UI to some unknown extend, just to make the whole thing feel new. We don't want to make the mistake they made with Microsoft Calculator in Vista, where they rewrote the guts of the application but 'forgot' to change the UI. The result? No one noticed, and people complained that Microsoft kept shipping the same crufty, old apps.
The first article, which is to follow soon, gives an overview of the language itself and, as such, does not contain any implementation details, but I feel that it is necessary to better understand the big picture, going forward. Links to all the articles will be posted on the project page for CGL.
Comments