Re: C to Eu translator

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi,

thank you Al and Andy and Derek for your replies.

Al wrote:

> Juergen Luethje wrote:

<snip>

>> Is an automatic translation actually possible?
>
>
> Hello Juergen,
>
> It's certainly possible, and already done to a point smile
>
> A while back i wrote a COM to Euphoria translator that takes
> a file with the code for a COM C interface and translates it
> into Euphoria code in a form suitable for my WinClass library.
> It takes a few seconds to convert an interface to Euphoria
> although i usually add a few custom items as well.
> Without it it would take a couple hours probably.

That sounds great!

> Some things are really easy to do, like place atoms
> where C variables once were, but other things are a
> little harder like making it aware that a POINT in C
> is actually going to be two atoms in the function call.
>
> I find it helps if you have another library in mind that
> you intend to use the resulting code with.  You can then
> gear the output to use parts of the library.  This helps
> with things like LOWORD and HIWORD and stuff like that.
>
> Try it yourself; it's not that hard really.

I think I had to write at least a scanner and a parser for the C
language. Thanks for considerably overestimating my programming
skills. smile
Maybe you can remove the "OM" from your "COM to Euphoria
translator"? How much micro $$ do you want? smile

I also understand what you Andy and Derek wrote.
An automatic translator, that produces correct but hard to read
Euphoria code is not very useful ...

How about only translating things that are safe and clear to do,
e.g. replacing all symbols such as "//", "==", "++", "&&", "||", "~",
and other stuff, thereby letting the C constructs that are not available
in Euphoria such as goto, setjump, pointers, pass-by-reference,
structures, etc. alone?

Then only the rest of the C program must be converted manually. Do you
think that there are many C programs, where this would save a
considerable amount of time, compared to converting the whole program
manually? Or is it not worth the effort, to write such a
"semi-translator"?

Regards,
   Juergen

-- 
 /"\  ASCII ribbon campain  |  Math problems?
 \ /  against HTML in       |  Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x].
  X   e-mail and news,      |
 / \  and unneeded MIME     |  http://home.arcor.de/luethje/prog/

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu