RE: C to Eu translator
- Posted by Andy Serpa <ac at onehorseshy.com> Jan 04, 2004
- 391 views
> > 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"? > Well, what is the ultimate purpose? If you're doing something like the COM library or something where it is actually useful to mimic the C-style, then ok. But you were talking about trying to learn from the code, but not understanding what it is doing. If you have to do the important (hard) parts of the translation manually, you'll have to understand exactly what the C code is doing. And once you understand that, it is much easier to just rewrite a Euphoria version from scratch (not a translation, but a re-expression of the same ideas in Euphoria) now that you know the things that need to be accomplished. You can't translate C without understanding C, bottom line. And if someone else made an auto-translator for you, the resulting Euphoria code would be no easier to understand than the original code...