February 20, 2005
Puma C++ transformation library
Today I looked at Puma. Puma is a library for applying transformations to C++ programs. It can do C++ lexical analysis, parsing and semantic analysis. The library provides an API for examining and modifying C++ abstract syntax trees. To support program transformation, it also allows a modified syntax tree to be "unparsed" back into C++ source code, which can then be compiled using a C++ compiler.
It seems to be quite robust. For example, looking through some of the tests, I saw that it can parse templates and even template metaprograms. I was also pleased to see that it is used as the back-end of AspectC++, which is relatively mature aspect oriented programming system for C++.
I considered using AspectC++ instead of CDL. Aspect oriented programming has a lot of cross-over with metaprogramming. One thing it wouldn't let me do though is generate a schema from C++ class definitions. It provides no way of outputting anything other than C++ as far as I can tell. I'll take a closer look at it soon.
I am considering using Puma to parse CDL. If it works out, it will eliminate one of the big risks and most of the development effort for my C++ metaprogramming system. As with my C# and Java to C++ translators, I think the key to getting a prototype up and running quickly is to find a library that will do most of the parsing and analysis for me.
Puma is GPL. I am not sure if that would be a problem for a commercial project. The game would not be compiled with or link to any of the GPLed code. But some of it would be automatically generated by GPLed code. Is code that is generated by a GPL tool also GPL? I'll do some research.
I haven't had a chance to actually try it out yet. It took me all day to get it to compile in Visual C++. I had to upgrade from Visual C++ 7.0 to 8.0 beta. 7.0 was not sufficiently standards compliant. Then I had to wade through GCC makefiles and figure out how to set up a VC++ project with all the necessary preprocessor definitions. Grr, C++ makes things too difficult for a lazy programmer like me!
It seems to be quite robust. For example, looking through some of the tests, I saw that it can parse templates and even template metaprograms. I was also pleased to see that it is used as the back-end of AspectC++, which is relatively mature aspect oriented programming system for C++.
I considered using AspectC++ instead of CDL. Aspect oriented programming has a lot of cross-over with metaprogramming. One thing it wouldn't let me do though is generate a schema from C++ class definitions. It provides no way of outputting anything other than C++ as far as I can tell. I'll take a closer look at it soon.
I am considering using Puma to parse CDL. If it works out, it will eliminate one of the big risks and most of the development effort for my C++ metaprogramming system. As with my C# and Java to C++ translators, I think the key to getting a prototype up and running quickly is to find a library that will do most of the parsing and analysis for me.
Puma is GPL. I am not sure if that would be a problem for a commercial project. The game would not be compiled with or link to any of the GPLed code. But some of it would be automatically generated by GPLed code. Is code that is generated by a GPL tool also GPL? I'll do some research.
I haven't had a chance to actually try it out yet. It took me all day to get it to compile in Visual C++. I had to upgrade from Visual C++ 7.0 to 8.0 beta. 7.0 was not sufficiently standards compliant. Then I had to wade through GCC makefiles and figure out how to set up a VC++ project with all the necessary preprocessor definitions. Grr, C++ makes things too difficult for a lazy programmer like me!
Comments:
<< Home
I have been following your progress of trying to wrassle C++ into some sort of modern language. I tried for a very long time to find a reasonable solution that gave me what I wanted (introspection so I could bind my scripting language) without making my code scary, but in the end.. I just gave up. It just was not worth it for me to jump through all those hoops.
I hope you can find a good solution, but make sure you think long and hard about whether finding that solution is actually worth it.
btw. PUMA does look pretty cool.
I hope you can find a good solution, but make sure you think long and hard about whether finding that solution is actually worth it.
btw. PUMA does look pretty cool.
Thanks for your feedback Billy. I'm not concerned about the effort involved in solving this problem. I love solving hard problems. My only goal is to learn new things. And I'm learning a whole bunch of new stuff with this project!
The way C++ is so entrenched in games development does frustrate me sometimes. I think there are two big obstacles slowing the adoption of other languages. The first is the lack of tools. If I want to program a console game in C#, I have to write my own compiler. The second is the performance-centric mindset of your typical game programmer. But that is beginning to change with the adoption of scripting languages and "higher level" languages for tools programming.
C++ isn't so bad though, especially if you are doing real OO, unit testing, refactoring, etc. Just look at all the awesome games that are written in C++. It can't be that bad!
The way C++ is so entrenched in games development does frustrate me sometimes. I think there are two big obstacles slowing the adoption of other languages. The first is the lack of tools. If I want to program a console game in C#, I have to write my own compiler. The second is the performance-centric mindset of your typical game programmer. But that is beginning to change with the adoption of scripting languages and "higher level" languages for tools programming.
C++ isn't so bad though, especially if you are doing real OO, unit testing, refactoring, etc. Just look at all the awesome games that are written in C++. It can't be that bad!
I'm pretty sure you're okay using GPL code to generate and manipulate code, provided the generated code doesn't link with a GPL library or runtime. gcc is GPL after all.
Yeah I think you're right Chad. It seems code compiled with GCC can be distributed for commercial purposes provided none of the code itself is GPL. For example, Sony's C++ compiler for PS2 is GCC. A lot of commercial games must be compiled with GCC. Good news!
Hello.
You wrote that you compile Puma using Visual C++ and spend full day for it. Cold you share your VC solution with people who more lazzy and not ready repeat this heroic deed?
You wrote that you compile Puma using Visual C++ and spend full day for it. Cold you share your VC solution with people who more lazzy and not ready repeat this heroic deed?
AV,無碼,a片免費看,自拍貼圖,伊莉,微風論壇,成人聊天室,成人電影,成人文學,成人貼圖區,成人網站,一葉情貼圖片區,色情漫畫,言情小說,情色論壇,臺灣情色網,色情影片,色情,成人影城,080視訊聊天室,a片,A漫,h漫,麗的色遊戲,同志色教館,AV女優,SEX,咆哮小老鼠,85cc免費影片,正妹牆,ut聊天室,豆豆聊天室,聊天室,情色小說,aio,成人,微風成人,做愛,成人貼圖,18成人,嘟嘟成人網,aio交友愛情館,情色文學,色情小說,色情網站,情色,A片下載,嘟嘟情人色網,成人影片,成人圖片,成人文章,成人小說,成人漫畫,視訊聊天室,a片,線上遊戲,色情遊戲,日本a片,性愛
Post a Comment
<< Home