The presumptuously named GodPL (Gamer or Deity? Programming Language) is a project I created for CS 152: Introduction to Programming Languages in Spring 2009.
The goal of the assignment was to design and implement an interesting domain-specific language.
The domain I came up with was a virtual world with simple, simulated inhabitants who could eat, move around, sexually reproduce, and die. It was inspired largely by the classic alife game, Creatures.
The language, GodPL, is a C-style language that is used to program the general behavior of a creature (called a Briyya) in the game. It has some syntactic constructs specific to event handling and time-based events.
I defined the grammar for GodPL using ANTLR. ANTLR was used to generate a lexer and parser in C#. I then used these to write a compiler that generates C# code from GodPL, and then uses Microsoft's CSharpCodeProvider library to compile the C# to an in-memory assembly.
I integrated this with the main GodPL runtime, which I wrote in C#, using Microsoft's XNA framework for the game loop and graphics.
All of my code, as well as compiled executables and sprites, are available under the MIT License at Google Code.
There are two versions of GodPL:
Since this project was done over a couple of stressful weeks and several sleepless nights, obviously neither the source code nor the actual software is well-polished. However, I hope someone might find it edifying, useful, or at least entertaining.