Jump to content
  • Advertisement
Sign in to follow this  
Sneftel

Code Generation Frameworks?

This topic is 4810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
are you talking about creating C++ code on the fly, during runtime?
Or would runtime generated assembly work as well?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!