Skip to main content
GameDev.net gamedev.net
🔒 Locked

Code Generation Frameworks?

Started by Sneftel Sep 14, 2005 at 6:29 PM 8 replies 1.6k views
Original Post
Sneftel
Sneftel
Does anyone know of frameworks for automatically generating C/C++ code (primarily data structures, but also functions) from data? Basically, something like the code generation in Rational Rose, but in library form, and capable of performing more complex actions (like graph traversals) as needed during the code-generation process?
SiCrane
SiCrane
What kind of data are you going to input into it? Something IDL like?
hplus0603
hplus0603
We wrote that in Perl. Our data descriptions can be simplified perl scripts (that use pre-defined functions), or XML. It's served us pretty well.

However, if possible, I would recommend against code generation. Using runtime data discovery and parsing is more flexible, and allows you to do more dynamic development.
enum Bool { True, False, FileNotFound };
Sneftel
Sneftel
Quote:
Original post by SiCrane
What kind of data are you going to input into it? Something IDL like?

Doesn't matter... the intermediate format, if there is one, will be generated by a GUI tool, and we'll have full control over it.
Sneftel
Sneftel
Quote:
Original post by hplus0603
We wrote that in Perl. Our data descriptions can be simplified perl scripts (that use pre-defined functions), or XML. It's served us pretty well.

However, if possible, I would recommend against code generation. Using runtime data discovery and parsing is more flexible, and allows you to do more dynamic development.
Our current system is data-driven, but we're looking to improve performance and memory efficiency, and want to support small mathematical functions inline without needing a complicated, slow, and yucky runtime function composition system. We've been considering a JIT-based solution, but wrangling a JIT engine to work on four different consoles would suck immense amounts of ass.
snk_kid
snk_kid
Quote:
Original post by Sneftel
... but in library form


boost MPL + Boost.Preprocessor comes to mind, if that is suitable i recommend getting this book don't worry its a short book (~270 pages excluding appendices) that will take about 1-2 days to read, shows you the techniques on how to write domain specific embedded languages (among other things) in C++ using those libraries.

I'm not sure if that is exactly what your looking for though, it sounds like you want something that is already/more declarative.
Sneftel
Sneftel
Template metaprogramming isn't really suitable for me, since I'll be generating C++ code not from other C++ code but from in-memory data structures or an intermediate format. Thanks for the links, though.
daerid
daerid
are you talking about creating C++ code on the fly, during runtime?
Or would runtime generated assembly work as well?
daerid@gmail.com
snk_kid
snk_kid
Quote:
Original post by daerid
are you talking about creating C++ code on the fly, during runtime?
Or would runtime generated assembly work as well?


nah he mentioned earlier he wants to generate C/C++ code not at runtime.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.