• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
  • entries
  • comments
  • views

Epoch Self-Hosting Progress

Sign in to follow this  
Followers 0


I've been working off and on for a few months now on creating a self-hosting compiler for the Epoch programming language.

In brief, this means that the language itself is robust enough to implement a complete compiler, which in turn is an implementation of the Epoch language. (Presently, Epoch is implemented by a compiler written in C++.)

Progress is steady, but the workload is immense. Instead of starting with a parser and gradually adding language features, I decided to take a somewhat reverse approach to the problem. The first phase was to remove the bytecode emitter from the C++ compiler and replace it with one implemented in Epoch; that was relatively easy and completed a couple of months ago.

The current phase involves replacing the entire code generation infrastructure with Epoch versions of the logic that currently exists in C++. In more classical terms, this is the entire back-end of the compiler: an Abstract Syntax Tree goes in, and binary executable code comes out.

As of tonight, all but 2 of the tests in the compiler test suite pass using the new back-end. There are two minor features left to implement (one test apiece): storing function pointers in structures, and value-based pattern matching. Once these are completed, the compiler will effectively be half Epoch and half C++.

After the back-end is replaced, there are two major phases remaining before the Epoch compiler is fully self-hosted. First and most importantly, I need to replace the type inference logic and the type system validation code. These are easily the most complex pieces of infrastructure in the existing compiler, so I fully anticipate that it will take a hefty amount of time to complete this phase.

Last but not least, once the type system is reimplemented in Epoch, it'll be time to redo the parser and AST generation code. This is kind of unfortunate given the amount of effort I've sunk into making the C++ parser fast, but the flip side is that I've got a lot of optimization tricks up my sleeve and a lot of solid code to iterate on.

The biggest change will be departing from the use of boost::spirit for parsing, which has been a mainstay of the Epoch parsing system since the early days. I'm not entirely sure I'll miss it, given the hideous compilation times and terrible error diagnostics. Hand-rolling a recursive-descent parser will give me much finer control over syntax error reporting, which is literally non-existent in the current compiler.

Right now the compiler and JIT code weigh in at about 37,000 lines of code. The Epoch compiler back-end, by way of contrast, is merely 3800 lines - a tenth of the code for roughly a third of the work. Adding some crucial language features and fixing some niggling bugs will probably serve to slice a decent chunk of that code away as well, meaning the final compiler will likely still be an order of magnitude more compact than the C++ implementation. Considering that the Epoch compiler source includes all the data structures and "standard" operations, that's pretty cool; if I threw the C++ standard library size into the mix, the actual code size would be far larger than the 37KLOC I've written myself.

Overall, the project is taking time, but shaping up nicely. In a few more days I should have all of the tests passing and the compiler generating itself from the back-end, at which point I'll move on to porting over the type system.

I'm mentally targeting the end of the year for reaching the fully self-hosted milestone. The amount of work involved in creating a new implementation of the type system is monumental, especially in a language with no standard library and plenty of weird runtime bugs left to squash. Rebuilding the parser is also a nontrivial amount of work, but shouldn't take more than a few weeks of careful effort to get at least most of the language supported.

And with that, it is time for some much-needed sleep. Stay tuned for more adventures!

Sign in to follow this  
Followers 0

1 Comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now