Live data from Hacker News

C to Java Translation. Automatic, Complete, Correct. Free for Open-Source.

mtsystems.ch

31–40 of 55 posts

Re: C to Java Translation. Automatic, Complete, Correct. Free for Open-Source.

#31
post #8

It says the translation is correct, is there any proof of that ?

Only in the form of translating and running dozens of C applications (programs and libraries) and running their testsuites. E.g. libcurl comes with a great extensive testsuite (a perl script running against the binary). Translated applications still need to be thoroughly tested and usually some bugs are still found. So we didn't formalize and verify our translation. Interestingly enough, we run into bugs in javac and…

This sounds like a great spin off - bug finding in C code. Have you put much thought into pursuing this?

Re: C to Java Translation. Automatic, Complete, Correct. Free for Open-Source.

#33

Main author here. Let me know if you have any questions. I’d be happy to answer.

If it really works - very impressive! Have you considered using sun.misc.Unsafe for things like pointer arithmetic?

Yes, but it's way too limited for replicating what you can do with C pointers. Therefore we wrote our own classes.

Re: C to Java Translation. Automatic, Complete, Correct. Free for Open-Source.

#34
post #15

Earlier quoted context omitted.

> Why do young students no longer learn C? Who said they don't? This project is about porting existing stuff, for interoperability, etc. Not as a way to "avoid learning C". > Don't you want to be closer to the underlying OS? No, why would I want to do that unless I have a specific need for that?

No, why would I want to do that unless I have a specific need for that? At least if you're using a Unix-like system, then understanding POSIX is essential for knowing how things work starting on an intermediate level.

And why would I want to understand how things work down in the OS?

Anyway, C is a horrible language. Between Fortran and Ada it's unclear to me why C should be chosen for anything, inertia and herdthink aside.

Re: C to Java Translation. Automatic, Complete, Correct. Free for Open-Source.

#35
post #32

Pretty neat. I did find a bug while I was playing around with it though: it doesn't correctly translate Duff's device.

Can you elaborate on that? What's the C code, the translated Java code and your expected Java code?

Thanks!

Re: C to Java Translation. Automatic, Complete, Correct. Free for Open-Source.

#36
post #9

Interesting how gotos are translated to switches 90% of C should be pretty easy to translate, but of course, the devil (and a lot of functionality in existing libraries) is in the details. There would be probably money in translating COBOL to Java, but maybe there are solutions already?

The main problem being undefined behaviour that is actually undefined and varies from compiler to compiler!

You are free to assume that undefined behavior never happens. Unless you want to support invalid c programs.

Re: C to Java Translation. Automatic, Complete, Correct. Free for Open-Source.

#37
post #21

Main author here. Let me know if you have any questions. I’d be happy to answer.

it's very kind of you to translate open source projects for free. I personally think you should give that more attention rather then just an italic sentence at the bottom of the page.

Thank you!

But of course a lot of development and money went into our translation framework. So the main aim has to be to make money with it. But as long as we have capacity, we're happy to translate open-source software and improving our translation while doing so.

Re: C to Java Translation. Automatic, Complete, Correct. Free for Open-Source.

#38
post #32

Pretty neat. I did find a bug while I was playing around with it though: it doesn't correctly translate Duff's device.

Can you elaborate on that? What's the C code, the translated Java code and your expected Java code? Thanks!

http://lmgtfy.com/?q=duff%27s+device&l=1#

Re: C to Java Translation. Automatic, Complete, Correct. Free for Open-Source.

#39

Earlier quoted context omitted.

Only in the form of translating and running dozens of C applications (programs and libraries) and running their testsuites. E.g. libcurl comes with a great extensive testsuite (a perl script running against the binary). Translated applications still need to be thoroughly tested and usually some bugs are still found. So we didn't formalize and verify our translation. Interestingly enough, we run into bugs in javac and…

This sounds like a great spin off - bug finding in C code. Have you put much thought into pursuing this?

Didn't think too much about it since there are many C specific analyzers and tools that do the same. Well, they do it way better. E.g. Valgrind.

Re: C to Java Translation. Automatic, Complete, Correct. Free for Open-Source.

#40

I wonder what the performance impact is. Why do young students no longer learn C? Don't you want to be closer to the underlying OS?

Most universities still teach a mandatory OS course where students build their own shell in C. Just because we start people off in block-based languages and python doesn't mean that Computer Scientists don't get the full tour of languages.
Post reply on HN