[cfe-dev] C++ to Python Project Proposal

Manuel Klimek klimek at google.com
Fri Nov 5 21:07:05 PDT 2010


The RecursiveASTVisitor
(http://clang.llvm.org/doxygen/RecursiveASTVisitor_8h_source.html)
might also be worth looking into.

Cheers,
/Manuel

On Fri, Nov 5, 2010 at 4:46 PM, Jeff Kunkel <jdkunk3 at gmail.com> wrote:
> I think I found it. Under "ModuleBuilder.h" in the codegen section there is
> the 'class CodeGenerator' which inherits from ASTConsumer. Since, I do not
> want to interface with 'CreateLLVMCodeGen' I do not want to use the
> 'CodeGenerator' class. However, I should be able to generate off of the
> 'ASTConsumer.'
> Thanks,
> Jeff Kunkel
> On Fri, Nov 5, 2010 at 7:38 PM, Jeff Kunkel <jdkunk3 at gmail.com> wrote:
>>
>> Aye, you said it stops before CodeGen. I was going to replace the llvm
>> code gen to an output a near source translation with boost::python
>> components being added in as needed. I am just having a hard time figuring
>> where to hook into the code.
>> Basically Clang completes the AST. Then Clang informs Clang-CodeGen that
>> it is complete and it may generate code for this module. I would like to
>> hook into this code gen step and replace it. Unfortunately, I cannot see how
>> it is hooked in. I cannot see the joint which connect CodeGen and the AST
>> generation.
>> Second, from the comments so far, I think this is a worthy
>> project. Unfortunately, the time it would take to reinvent what
>> boost::python does with CPython might be a bear in its own right. However,
>> the library will be made with the hope that the boost::python calls may be
>> replaced with strait CPython.
>> - Thanks
>> Jeff Kunkel
>>
>> On Fri, Nov 5, 2010 at 7:07 PM, Cédric Venet <cedric.venet at laposte.net>
>> wrote:
>>>
>>> Le 05/11/2010 22:38, Jeff Kunkel a écrit :
>>> > Stefan,
>>> >
>>> > Aye, I agree. But, until that environment exists, I cannot use it.
>>> >
>>> > Oh, any advice on a starting point? I am floundering about the
>>> > clangCodeGen library, but I am not sure this is the correct place to
>>> > insert my translation.
>>> >
>>>
>>> I am no expert but I do not think its the good place. The simplest
>>> things would probably be to build the ast (ie a standard compilation
>>> which stop before codegen) and then walk the list of
>>> definition/declaration and emit your binding for each. you may want to
>>> look at various ast consumers as examples (don't know if it is better to
>>> do as ast consumer or to walk the ast yourself.)
>>> No a lot of information here, but it may answer your initial question
>>> better than the other (interesting) discutions.
>>>
>>> regards,
>>> Cédric
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>




More information about the cfe-dev mailing list