473,779 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A CFront-like compiler available?

Hi,
I know that some granddaddy-level C++ compiler can compile C++ code
into a C intermediate. Apart from that, however, I can not find any
modern compiler to do that. And in fact, I think, this factor is very
pragmatical for a C programmer to learn Java more effectively.

Any one can give me some information on that ? Tools, compilers or
other methods applicable are all attractive to me. But where to get
them?

Thanks.
Mar 4 '07 #1
16 2745
Bu*******@hotma il.com wrote:
Hi,
I know that some granddaddy-level C++ compiler can compile C++ code
into a C intermediate. Apart from that, however, I can not find any
modern compiler to do that. And in fact, I think, this factor is very
pragmatical for a C programmer to learn Java more effectively.
How can a tool that converts C++ to C help a C programmer to learn Java
more effectively?

--
Ian Collins.
Mar 4 '07 #2
On Sun, 04 Mar 2007 22:32:33 +1300, Ian Collins <ia******@hotma il.com>
wrote:
>Bu*******@hotm ail.com wrote:
>Hi,
I know that some granddaddy-level C++ compiler can compile C++ code
into a C intermediate. Apart from that, however, I can not find any
modern compiler to do that. And in fact, I think, this factor is very
pragmatical for a C programmer to learn Java more effectively.
How can a tool that converts C++ to C help a C programmer to learn Java
more effectively?
Oh, what I wrote is not clear indeed. Well, what I mean is that I hope
to get a tool that can translate or compile Java/C++ code into C code,
just like the old CFront did. I think this would be meaningful and
helpful for me to dig into the deep implementation mechanism of C++ or
Java through reading C code.
Mar 4 '07 #3

Bu*******@hotma il.com wrote:
Hi,
I know that some granddaddy-level C++ compiler can compile C++ code
into a C intermediate. Apart from that, however, I can not find any
modern compiler to do that. And in fact, I think, this factor is very
pragmatical for a C programmer to learn Java more effectively.

Any one can give me some information on that ? Tools, compilers or
other methods applicable are all attractive to me. But where to get
them?

Thanks.
Why do you want to do this, particularly for learning Java.

PS. I don't think any extant tool does what you want.

Mar 4 '07 #4
On 4 Mar 2007 02:03:21 -0800, "santosh" <sa*********@gm ail.comwrote:
>
Bu*******@hotm ail.com wrote:
>Hi,
I know that some granddaddy-level C++ compiler can compile C++ code
into a C intermediate. Apart from that, however, I can not find any
modern compiler to do that. And in fact, I think, this factor is very
pragmatical for a C programmer to learn Java more effectively.

Any one can give me some information on that ? Tools, compilers or
other methods applicable are all attractive to me. But where to get
them?

Thanks.

Why do you want to do this, particularly for learning Java.

PS. I don't think any extant tool does what you want.
Oh, what I wrote is not clear indeed. Well, what I mean is that I hope
to get a tool that can translate or compile Java/C++ code into C code,
just like the old CFront did. I think this would be meaningful and
helpful for me to dig into the deep implementation mechanism of C++ or
Java through reading C code.
Mar 4 '07 #5
Bunny....@hotma il.com wrote:
On 4 Mar 2007 02:03:21 -0800, "santosh" <sa*********@gm ail.comwrote:

Bu*******@hotma il.com wrote:
Hi,
I know that some granddaddy-level C++ compiler can compile C++ code
into a C intermediate. Apart from that, however, I can not find any
modern compiler to do that. And in fact, I think, this factor is very
pragmatical for a C programmer to learn Java more effectively.

Any one can give me some information on that ? Tools, compilers or
other methods applicable are all attractive to me. But where to get
them?

Thanks.
Why do you want to do this, particularly for learning Java.

PS. I don't think any extant tool does what you want.

Oh, what I wrote is not clear indeed. Well, what I mean is that I hope
to get a tool that can translate or compile Java/C++ code into C code,
just like the old CFront did. I think this would be meaningful and
helpful for me to dig into the deep implementation mechanism of C++ or
Java through reading C code.
Hmm, I think you're off on a wild goose chase. If you want to
understand how C++ and Java programs are compiled and how their
runtime support is implemented, you'll have to understand their
standards, the source code of a conforming implementation and it's
accompanying libraries, not to mention the characteristics of the
target machine architecture.

Simply reading a source translation will get you nowhere, even if you
can find a tool to do that.

Mar 4 '07 #6
On 4 Mar 2007 02:15:52 -0800, "santosh" <sa*********@gm ail.comwrote:
>Bunny....@hotm ail.com wrote:
>On 4 Mar 2007 02:03:21 -0800, "santosh" <sa*********@gm ail.comwrote:
>
Bu*******@hotm ail.com wrote:
Hi,
I know that some granddaddy-level C++ compiler can compile C++ code
into a C intermediate. Apart from that, however, I can not find any
modern compiler to do that. And in fact, I think, this factor is very
pragmatical for a C programmer to learn Java more effectively.

Any one can give me some information on that ? Tools, compilers or
other methods applicable are all attractive to me. But where to get
them?

Thanks.

Why do you want to do this, particularly for learning Java.

PS. I don't think any extant tool does what you want.

Oh, what I wrote is not clear indeed. Well, what I mean is that I hope
to get a tool that can translate or compile Java/C++ code into C code,
just like the old CFront did. I think this would be meaningful and
helpful for me to dig into the deep implementation mechanism of C++ or
Java through reading C code.

Hmm, I think you're off on a wild goose chase. If you want to
understand how C++ and Java programs are compiled and how their
runtime support is implemented, you'll have to understand their
standards, the source code of a conforming implementation and it's
accompanying libraries, not to mention the characteristics of the
target machine architecture.

Simply reading a source translation will get you nowhere, even if you
can find a tool to do that.
Yes, it is really a great job to understand every aspect of a big
language like C++ or Java, however, what I care the most is its
runtime characteristics instead of their compilers or even the whole
language systems. I use Assembly language to study C and thus have
achieved a very good undestanding of the C runtime mechanism. So, I
wonder if there is also a similar way to analyze C++ or Java. In my
opinion, that is really a short-cut.
Mar 4 '07 #7
Bu*******@hotma il.com wrote:
On 4 Mar 2007 02:15:52 -0800, "santosh" <sa*********@gm ail.comwrote:
>>
Simply reading a source translation will get you nowhere, even if you
can find a tool to do that.

Yes, it is really a great job to understand every aspect of a big
language like C++ or Java, however, what I care the most is its
runtime characteristics instead of their compilers or even the whole
language systems. I use Assembly language to study C and thus have
achieved a very good undestanding of the C runtime mechanism. So, I
wonder if there is also a similar way to analyze C++ or Java. In my
opinion, that is really a short-cut.
No, it isn't. If you understand an assembler, there is a fairly clear
relationship with unoptimised C.

The same is not true with C and C++.

--
Ian Collins.
Mar 4 '07 #8
Bu*******@hotma il.com wrote:
On 4 Mar 2007 02:15:52 -0800, "santosh" <sa*********@gm ail.comwrote:
Bunny....@hotma il.com wrote:
On 4 Mar 2007 02:03:21 -0800, "santosh" <sa*********@gm ail.comwrote:


Bu*******@hotma il.com wrote:
Hi,
I know that some granddaddy-level C++ compiler can compile C++ code
into a C intermediate. Apart from that, however, I can not find any
modern compiler to do that. And in fact, I think, this factor is very
pragmatical for a C programmer to learn Java more effectively.

Any one can give me some information on that ? Tools, compilers or
other methods applicable are all attractive to me. But where to get
them?

Thanks.

Why do you want to do this, particularly for learning Java.

PS. I don't think any extant tool does what you want.

Oh, what I wrote is not clear indeed. Well, what I mean is that I hope
to get a tool that can translate or compile Java/C++ code into C code,
just like the old CFront did. I think this would be meaningful and
helpful for me to dig into the deep implementation mechanism of C++ or
Java through reading C code.
Hmm, I think you're off on a wild goose chase. If you want to
understand how C++ and Java programs are compiled and how their
runtime support is implemented, you'll have to understand their
standards, the source code of a conforming implementation and it's
accompanying libraries, not to mention the characteristics of the
target machine architecture.

Simply reading a source translation will get you nowhere, even if you
can find a tool to do that.

Yes, it is really a great job to understand every aspect of a big
language like C++ or Java, however, what I care the most is its
runtime characteristics instead of their compilers or even the whole
language systems. I use Assembly language to study C and thus have
achieved a very good undestanding of the C runtime mechanism. So, I
wonder if there is also a similar way to analyze C++ or Java. In my
opinion, that is really a short-cut.
It depends on what exactly you mean by runtime system. You can try to
understand what's happening at a machine level for compiled languages
by examining the assembly output of the language's compiler, but this
is far more difficult for interpreted languages like Java. Java in
particular, is compiled to "bytecode", which runs under a complex
virtual machine, which does interpretation and runtime compilation in
combination. The runtime support for Java programs is also
significantly larger and more complex than for C. For C++, features
like RTTI, exception handling and name mangling will also complicate
matters.

C is closer to assembler than C++ and particularly Java. You'll have
to know the innards of the compiler/VM and associated libraries, in
conjunction with the language's specification to really understand
what's happening at the machine level.

All this assuming that you can get a tool to translate arbitrary C++
and Java source into C.

Mar 4 '07 #9
On 4 Mar 2007 03:01:15 -0800, "santosh" <sa*********@gm ail.comwrote:
>Bu*******@hotm ail.com wrote:
>On 4 Mar 2007 02:15:52 -0800, "santosh" <sa*********@gm ail.comwrote:
>Bunny....@hotm ail.com wrote:
On 4 Mar 2007 02:03:21 -0800, "santosh" <sa*********@gm ail.comwrote:
Bu*******@hotm ail.com wrote:
Hi,
I know that some granddaddy-level C++ compiler can compile C++ code
into a C intermediate. Apart from that, however, I can not find any
modern compiler to do that. And in fact, I think, this factor is very
pragmatical for a C programmer to learn Java more effectively.

Any one can give me some information on that ? Tools, compilers or
other methods applicable are all attractive to me. But where to get
them?

Thanks.

Why do you want to do this, particularly for learning Java.

PS. I don't think any extant tool does what you want.

Oh, what I wrote is not clear indeed. Well, what I mean is that I hope
to get a tool that can translate or compile Java/C++ code into C code,
just like the old CFront did. I think this would be meaningful and
helpful for me to dig into the deep implementation mechanism of C++ or
Java through reading C code.

Hmm, I think you're off on a wild goose chase. If you want to
understand how C++ and Java programs are compiled and how their
runtime support is implemented, you'll have to understand their
standards, the source code of a conforming implementation and it's
accompanying libraries, not to mention the characteristics of the
target machine architecture.

Simply reading a source translation will get you nowhere, even if you
can find a tool to do that.

Yes, it is really a great job to understand every aspect of a big
language like C++ or Java, however, what I care the most is its
runtime characteristics instead of their compilers or even the whole
language systems. I use Assembly language to study C and thus have
achieved a very good undestanding of the C runtime mechanism. So, I
wonder if there is also a similar way to analyze C++ or Java. In my
opinion, that is really a short-cut.

It depends on what exactly you mean by runtime system. You can try to
understand what's happening at a machine level for compiled languages
by examining the assembly output of the language's compiler, but this
is far more difficult for interpreted languages like Java. Java in
particular, is compiled to "bytecode", which runs under a complex
virtual machine, which does interpretation and runtime compilation in
combination. The runtime support for Java programs is also
significantl y larger and more complex than for C. For C++, features
like RTTI, exception handling and name mangling will also complicate
matters.

C is closer to assembler than C++ and particularly Java. You'll have
to know the innards of the compiler/VM and associated libraries, in
conjunction with the language's specification to really understand
what's happening at the machine level.

All this assuming that you can get a tool to translate arbitrary C++
and Java source into C.
What you said is very helpful to me and I am preparing to study more
about C++ compiler and Java VM, that seems to be a real need. Thank
you.
Mar 4 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
2076
by: Bootstrap Bill | last post by:
Are there any open source C++ compilers that will produce C code? I understand the first C++ compilers operated this way.
133
8599
by: Gaurav | last post by:
http://www.sys-con.com/story/print.cfm?storyid=45250 Any comments? Thanks Gaurav
10
503
by: Rohit Upadhyay HCST | last post by:
Hi !!! I wanted to migrate to c++, But Im in no hurry so I actually want to see how the C++ calls get translated into C, using Cfront(the original thing that Bjourne developed). But I cant find any place to download it from ? Any links,resources ?
0
1572
by: Alfred B. Thordarson | last post by:
I have unsuccessfully searched back and forth for a solution to the following problem. I hope someone out there can help me. I have created a C++ .NET wrapper for a 3-rd party C based DLL (cfront.dll from Navision) but the wrapper access to the DLL doesn't work for some of the exported functions?!? To illustrate what I mean, I have created the following small test-case. You simply compile and link it using the cf.h and libload.c (from...
14
3286
by: Henning Hasemann | last post by:
Hi all, sounds trivial (I hope it is): Im searching for a way to get a time-value thats more exact than just seconds (i.e. I need milli- or microseconds or something similar, just at least as good as 1/100 second should suffice) and it should work with gcc (really g++) under linux and the MingW compliant under windows xp. I found an easy and universal sounding way in gmtime & co, but they dont seem to be available under my windows mingw...
2
2788
by: napi | last post by:
I managed to compile CFront 3.03 on my Ubuntu Linux kernel 2.6.20-15. I compiled CFront with g++ version 4.1.2 and used bison 2.3 to process the gram.y file. When I compiled this program using "CC -F hello.C": --------------------------------------- hello.C------------------------------------------------- struct y { int p;
5
1999
by: JohnQ | last post by:
What is the status of cfront in regards to copyright and licensing? The source code is available on the web in at least one location (should it be?). John
104
4621
by: JohnQ | last post by:
Well apparently not since one can step thru template code with a debugger. But if I was willing to make the concession on debugging, templates would be strictly a precompiler thing? I have a feeling the answer I'm going to get back will be "no, because templates have taken on a life of their own since their original conception and now also affect compiler implementation" (read: not good, IMO. John
40
2686
by: Campy Happer | last post by:
Hello all, I would like to bring to your attention a concept and a term for it that I think is long overdue. But first: In the bad old days of programming, before subroutines were even available, people used to write "spaghetti code", which was an unreadable, unmaintainable mess of "goto" statements.
7
1711
by: Chris | last post by:
Hi All, This is a weird one but I am hoping someone can help or has some pointers, a recipe how to do the following: I have to move some code from c++ to objective-c and to do this I must remove all defined templates. I am not really a c++ guy so I have not worked with templates all that much (not really at all) and as such I don't have a good idea where to start.
0
9471
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10302
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10136
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8958
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4036
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.