Excerpts from David Cournapeau's message of 2010-04-22 05:09:43 +0200:
> On Tue, Apr 20, 2010 at 7:53 PM, Sebastien Binet <[email protected]> wrote:
> > Excerpts from David Cournapeau's message of 2010-04-20 12:06:17 +0200:
> >> On Tue, Apr 20, 2010 at 12:57 AM, Haoyu Bai <[email protected]> wrote:
> >>
> >> > Hi,
> >> >
> >> > I just found a project on GitHub which might do the thing you want:
> >> >
> >> > http://github.com/cournape/cython-codegen
> >>
> >> That code is horrible though :)
> >
> > don't worry about that, I am dealing with high energy physicists (C++
> > and python) code on a daily basis :)
> 
> I love the  researchers/C++ combination, always full of surprises :)
> 
> I mostly meant that something reusable should not be based on this
> code at all - neither the implementation nor the idea of reusing
> gccxml makes much sense for something meant to be used in the long
> term. Gccxml is not that great, because it is not really maintained, a
> PITA to build, and you cannot force C mode (which was the biggest
> issue in my case, and I guess an issue for many cython users).
> 
> >
> > thanks for the link.
> > llvm/clang was on my radar (I played a bit w/ llvm-py) but this
> > tutorial will most definitely help !
> 
> Yes, unfortunately, there is no python API, and llvm is not as mature
> as I had hoped (the API has significantly changed since this tutorial,
> for example). OTOH, for C++, llvm code is relatively readable, and
> there are also an ocaml interface and a haskell one
> (http://augustss.blogspot.com/) - maybe a good excuse to learn
> haskell.
> 
> It took me half a day to be able to implement a basic pre-processor in
> C++ with llvm, so anyone more familiar with C++ (and parsing
> techniques) should be able to implement something useful in a short
> amount of time,

ok...
let me push something out of the door:
http://bitbucket.org/binet/cylon/src/tip/ext/clang/genjson/

the code is still *very* crappy and it seems I managed to make the
clang plugin loader crash when STL headers are included in someone's
source code...

but it would be a start.

in that directory you'll find a dumb Makefile which should:
 - compile the CLang plugin library
 - run the plugin on the utest.cxx file (through run.py)
   - which will create a utest_ast.py file
   - and then create a utest_ast.json file from it

now that I know a bit more my way around CLang's source code, I shall
re-do the exercize using the ast-print-xml plugin as inspiration (for
some reason, that plugin crashes or just creates corrupted xml
files...)

I mainly put the utest_ast.{py,json} as a tentative start for feedback
on what and how types,fcts,... should be exposed.

(a proper python API to manipulate those ast/json structures should
also be devised)

cheers,
sebastien.
-- 
#########################################
# Dr. Sebastien Binet
# Laboratoire de l'Accelerateur Lineaire
# Universite Paris-Sud XI
# Batiment 200
# 91898 Orsay
#########################################
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to