May, 2009

GodPL Screenshot

GodPL Screenshot

GodPL

GodPL Screenshot

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.