Re: [Vala] Vala inverse compilation?



Hi,

2009/11/19 "Andrés G. Aragoneses" <knocte gmail com>:

For the purposes of having a tool that, instead of converting vala code
to C, would do the other way around (GObject-C to Vala), would the
current architecture of the vala compiler help on developing this task?
I don't think so.
I'm wondering if the process of generation of C fragments could be
easily refactored to be able to do a C-language scanner from that.
I don't think it's possible. You can use C and Vala ast types from
libvala (and use libvala to output vala code). But you'll need to
write a C parser, and have some rules for converting statements. This
way would work for converting hand-written code, but converting e.g.
Vala generated code, would give "unuseable" Vala code, unless you look
for all the tricks used in the vala code generator (which is a big
chunk of code) such as do{...}while(0)

Not looked at vala sources yet at all, sorry. Any pointers or gross
estimation of work is appreciated. Thanks!
I think you can use gobject-introspection to get the GObject part
(that is, gobject conventions to vala) as is used to generate
bindings, for the C part, you'll have to write something that
translates C statements to vala ones. I think you can do a relatively
good job for "simple" types (that is, excluding arrays, delegates,
which have length/target), but the generated code would need to be
reviewed.

I'm not sure it would be way better than converting the C code
directly by hand (that is, if you want readable Vala code).

HTH,
Abderrahim



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]