Re: [Vala] Vala inverse compilation?



Abderrahim Kitouni escribió:
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).

Cool thanks for your input!

I understand that the vala code would be not so readable as to a code
developed by a real developer, but from a maintainability point of view,
what is better? C code or unreadable vala code? :)

Let's see if I have time to investigate your ideas. I would do it as you
suggest, first focus on simple types, and then progress from that.

        Andres

-- 





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