Re: C to Eu translator
- Posted by "Derek Parnell" <ddparnell at bigpond.com> Jan 03, 2004
- 393 views
----- Original Message ----- From: "Juergen Luethje" <j.lue at gmx.de> To: "EUforum" <EUforum at topica.com> Subject: C to Eu translator > > > Hi all! > > No, there is no typo in the subject. I actually mean a C -> Eu > translator. Does someone intend to write such a program? > > As a layman and autodidact, I believe I learnt 80-90% of what I know > about progranmming, by studying source code written by other people. > Many -- especially professional -- code is written in C. Because I > cannot understand most of that code, I can't learn from it. > > I know some very simple things that can be done in an editor: > - replace "//" with "--" > - replace "==" with "=" > - replace "++" with "+=1" > - replace "&&" with "and" > - replace "||" with "or" > - replace "~" with "not_bits(" > - replace "printf(" with "printf(1, " > - replace word "const" with "constant" > - replace word "int" with "integer" > - (replace word "void" with "procedure") > > This is not much, and a translator would be much better of course. > Is an automatic translation actually possible? > A number of C constructs are not available in Euphoria so they would have to be emulated (at best) and this would make the source code even more obscure. Constructs such as goto, setjump, pointers, pass-by-reference, structures, are very common in C code and none of them are in Euphoria. So to answer your question, Yes I suppose it could be done, but would it be worth it. It might be easier to learn C instead. -- Derek