Subject: C to JVM compiler (AMPC)

  • Thread starter Mohd Hanafiah Abdullah
  • Start date
B

Brandon J. Van Every

Ed said:
I wonder if this, combined with the Comeau compiler, would allow one
to run C++ programs on a JVM?

C++ source -> Comeau -> C source -> AMPC -> JVM
Are you saying Comeau is a C++ source --> C source translator? I had
not heard of such perverse beasts before. I'm aware of things like
SWIG, but they don't do that. Whether Comeau does this or not, are
there other products that do?

--
Cheers, www.indiegamedesign.com
Brandon Van Every Seattle, WA

"We live in a world of very bright people building
crappy software with total shit for tools and process."
- Ed McKenzie
 
I

Ioannis Vranos

Brandon said:
Ouch. As an ex-DEC employee, that hurts! Well, some of the DEC Alpha
workstations were great, and others were pieces of junk. Some idiot
decided to ship a 533 MHz machine without much of anything in the way of
memory cache. I forget when this super cheapass memory controller was
supposed to actually be justifiable / not harmful, but talk about
pigeonholeing the applicability of your hardware! We had a 533 MHz box
like that in our lab, and it was regularly getting whipped by our 300
MHz machines that had proper caches. We nicknamed the sucker "the Yugo"
and put a photo of that ignoble automobile on it as the desktop background.


Interesting. This also makes his explanation more clear. :)
 
J

Jerry Coffin

Brandon J. Van Every wrote:

[ ... ]
Are you saying Comeau is a C++ source --> C source translator? I had
not heard of such perverse beasts before. I'm aware of things like
SWIG, but they don't do that. Whether Comeau does this or not, are
there other products that do?

Yes, Comeau translates C++ to C, though this fact is normally pretty
well hidden, other than a switch to tell it what C compiler to use as
its back end.

The original C++ compiler (cfront) also translated C++ to C. Quite a
few of the other early C++ compilers (e.g. Oregon and Glockenspiel,
IIRC) were ports of cfront that worked essentially the same way.
 
M

Mohd Hanafiah Abdullah

Are you saying Comeau is a C++ source --> C source translator? I had
not heard of such perverse beasts before. I'm aware of things like
SWIG, but they don't do that. Whether Comeau does this or not, are
there other products that do?

Check out http://www.edg.com. It sells among others C++ to C converter.
Apparently, Comeau also uses the C++ to C converter from EDG.

I was also informed that the LLVM group at U of Illinois modified gcc 3.4
that has a back-end that emits portable C code. This is their website:
http://llvm.cs.uiuc.edu/

Napi
 
T

those who know me have no need of my name

[fu-t set]

in comp.lang.c i read:
AMPC is based upon the American National Standards Institute C (ANSI C),
X3.159-1989. There are however a few differences between AMPC and a
fully compliant ANSI C compiler. The differences of AMPC with a fully
compliant ANSI C compiler are described in AMPC's product description.

would a summary really have been too difficult to include?

language: no bit-fields and cannot goto across blocks. elsewhere it is
mentioned that argc and argv are predeclared -- which makes me guess that
using my own identifiers will fail.

tools (not specified by the standard anyway): no debugger.

some limitations are not limitations (jni support), while others are
incorrect (static -- which is now supported -- is not a type).

some are a little hard to grasp just from the list, e.g., i think that one
must arrange to compile the (automatically created?) _touch_files.c and/or
_pointable_funcs.c files if file scoped objects and/or function pointers
are used (respectively).

there is no mention of long double or wide-characters. a lack of wide-
character support is not a tragedy as c89 itself is woeful. since you
target the jvm you should consider supporting amd1 in the future.
Hardware Requirements:
- Any x86 compatible computer running MS Windows XP
- Any Macintosh computer running Mac OSX
- Any x86 compatible computer running Linux

i hope the only reason for these is that you merely have not yet compiled
ampc using ampc, which would reduce the requirements to: a conforming jdk
and sufficient disk space. your own code (even if never released) should
be *the* prime example of how useful it is to target the jvm.

though i did not read it extensively i noticed some other oddities in the
manual, e.g., it is noted that strcoll and strxfrm are not c89 functions
(they are), and i hope that the second example in section 4.1 fails to
compile (even if one accepts the pre-declaration of argc and argv -- which
i find quite annoying -- it still leaves cnt and count undeclared, and has
an invalid escape in the string literal argument to the first printf):

| #include <stdio.h>
|
| main ()
| {
| printf("%i parameters entered \.",argc);
|
| for (cnt = 0; cnt <= argc -1; cnt++)
| {
| printf("Parameter %d is %s\n",count, argv[cnt]);
| }
| }
 
T

those who know me have no need of my name

in comp.lang.c++ i read:
I wonder if this, combined with the Comeau compiler, would allow one
to run C++ programs on a JVM?

C++ source -> Comeau -> C source -> AMPC -> JVM

only if comeau produces an ampc target -- the source that comeau produces
is tightly targeted to specific native compilers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,233
Latest member
AlyssaCrai

Latest Threads

Top