• 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
    625
  • comments
    1446
  • views
    1006357

Yeah, I'm rewriting my compiler again.

Sign in to follow this  
Followers 0
ApochPiQ

498 views

Release 10 of Epoch was a big deal, because it represented a complete overhaul of the language implementation - pretty much everything was redone, from the parser grammars on up to the standard library implementation. It took a long time, dramatically cut back the number of features that still work, and generally destroyed more brain cells than I care to think about.

So, it may seem unusually stupid to be rewriting the Epoch compiler again as the core work behind R12. After all, R11 is barely out the door, and surely there's time to do something like, oh, say, make the language a bit more powerful?

Unfortunately, adding more features and richness to the language has hit a point of diminishing returns - not because of the language's completeness (which is not to say it's anywhere near complete), but rather because of iteration time. It's gotten to the point where compiling even the relatively trivial Era source code takes about 30 seconds. This is not acceptable.

R12 will, therefore, feature a rewritten compiler. The VM and remainder of the toolchain will remain in place; all that's really going away is the parser and the AST decoration layer.

Here's an executive summary of the changes coming in R12:

  • Replacing boost::spirit::classic with something faster
  • Replacing the extensively ad hoc code generation mechanism with a proper AST decoration layer
  • Optimizing certain elements of the compiler chain for speed and memory usage
  • Implementing separate compilation to further reduce program compile times

    Right now I'm playing with boost::spirit::qi, the successor to spirit classic; it reports a roughly 20x speed increase in certain small test cases, but has some downsides. In particular, I can't seem to reliably compile the parser using qi, because it generates so much code that Visual C++ literally reports an out-of-memory error. Moreover, I don't know how well qi scales to nontrivial grammars like that used by Epoch.

    So there's a good chance I may bite the bullet and go deploy a more traditional parser generation framework for the next release, because I can't afford to have my tools crapping themselves on relatively straightforward code. I really don't want to do this, because it'll make dynamic parsing a righteous pain in the ass, but what has to be done has to be done.

    I hope to improve the ~30 second build time for Era to under a second. That ought to be enough for the next Epoch release, I think!

0
Sign in to follow this  
Followers 0


4 Comments


So I got qi working by decomposing the grammar into dozens of tiny little rules; this seems to make the compiler not barf, but build times are still measured in minutes for the Epoch compiler, which is kind of disappointing.

On the plus side, I'm a good bit down the road of generating a proper AST representation using qi and fusion, which is actually going fairly well and hasn't been much of a pain. So far function definitions are being parsed correctly and the AST is populated with them, but there's no support for statements or general expressions or entity calls yet. So obviously lots of work left to do.

I had dimly hoped, at one point, to get the compiler running again by the end of the weekend; but with the complete redesign of the AST generation mechanism, it'll take the rest of today just to reach a point where the AST is getting populated to begin with. After that I'll have to rewrite all the decoration logic, the semantic checking logic, and the code generation subsystem.

Blargh. Obviously this will end up being the multi-week ordeal that I dreaded it would become.
0

Share this comment


Link to comment
Statements are in, and I'm currently waiting on the last compile that should fix up the remaining issues with general expressions. Entity calls will probably have to wait until later this week, as I'm completely exhausted and really only forcing myself to stay awake until I can get expression parsing done.

In other news, my head is killing me.
0

Share this comment


Link to comment
I am not exactly sure how you are doing things currently I have not really been keeping super close track on your project. By the sounds of it, if I am understanding correctly, you are going straight from source into an AST. If this is the case there is a lot of overhead there. The solution would be to use a recursive parser to walk the syntax and generate a intermediate system that would then be assembled into the AST. I am not sure if that is what qi is doing for you or not.

The issue is that boost in general is very generic. You know your syntax better then boost does so in essence if you want the compile time to go down you are going to need to drop boost and create your own parsing process manually. This will allow you to make assumptions based off syntax that qi will never be able to make. These assumptions are what are going to drop your compile time dramatically but it may take a long time to get right but leaves more room for optimization down the road.
0

Share this comment


Link to 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