Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SML to C!

1 view
Skip to first unread message

Majid Ghaderi

unread,
Aug 13, 2001, 4:31:56 PM8/13/01
to

Dear Sir or Madam

I am looking for a tool which can convert Sml code to
C/C++ source code and run under x86 machines with
Linux or Windows installed. I have found Sml2C but it
is not designed to run on x86 machines.

Best regards,

Majid Ghaderi


__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

Daniel C. Wang

unread,
Aug 13, 2001, 5:13:38 PM8/13/01
to

Majid Ghaderi <ghad...@yahoo.com> writes:

> Dear Sir or Madam
>
> I am looking for a tool which can convert Sml code to
> C/C++ source code and run under x86 machines with
> Linux or Windows installed. I have found Sml2C but it
> is not designed to run on x86 machines.
>

I recomend you look at MLton and the MLKit

http://www.sourcelight.com/MLton/
and
http://www.itu.dk/research/mlkit/

both produce both C as well as x86 native code.

I've had success with developing medium sized programs in SML/NJ and then
"shipping" the program by recompiling with MLton.


Alexander V. Voinov

unread,
Aug 13, 2001, 7:26:17 PM8/13/01
to
Hi Daniel

"Daniel C. Wang" wrote:

> I've had success with developing medium sized programs in SML/NJ and then
> "shipping" the program by recompiling with MLton.

What's the difference in the performance in the case of the native and the
C-generated codes?

Alexander

Daniel C. Wang

unread,
Aug 13, 2001, 8:42:22 PM8/13/01
to

You might want to ask on the MLton mailing list. I'd assume the performance
should be comparable, but it definitely much faster to emit native code than
to ask gcc to digest very larger C files.

sweeks

unread,
Aug 14, 2001, 7:24:02 AM8/14/01
to

>> What's the difference in the performance in the case of the native and the
>> C-generated codes?
>
>You might want to ask on the MLton mailing list. I'd assume the performance
>should be comparable, but it definitely much faster to emit native code than
>to ask gcc to digest very larger C files.

You are correct in that compile times are indeed much shorter with MLton's
native backend than with the C backend. However, run time performance is also
much better with the native backend than with the C backend (and getting better
daily). For some numbers, I took the latest MLton release (20010806) and ran it
on our suite of benchmarks (available off of the MLton performance page
http://www.sourcelight.com/MLton/performance.html), comparing the native and C
backends. I computed the ratio of the run time of the benchmark compiled with
the C backend to the benchmark compiled with the native backend. In 32 out of
of 36 benchmarks, the ratio was greater than one (i.e. the native backend is
doing better than the C backend). Here are the numbers.

benchmark ratio
---------------- -----
barnes-hut 1.2
checksum 1.3
count-graphs 1.7
DLXSimulator 1.1
fft 1.6
fib 1.1
hamlet 1.7
knuth-bendix 1.2
lexgen 2.5
life 1.9
logic 1.2
mandelbrot 2.1
matrix-multiply 1.8
md5 1.5
merge 1.3
mlyacc 1.4
mpuz 2.2
nucleic 1.1
peek 2.2
psdes-random 0.9
ratio-regions 2.4
ray 1.4
raytrace 1.5
simple 1.7
smith-normal-form 1.0
tailfib 0.9
tak 1.5
tensor 0.5
tsp 1.4
vector-concat 2.7
vector-rev 3.3
vliw 1.4
wc-input1 2.7
wc-scanStream 1.6
zebra 1.8
zern 1.8

Just for completeness, here are the compile times, in seconds, of the
benchmarks, compiled with both the native and C backends. The native backend is
almost always faster, often significantly so.

benchmark native C
-------------- ------ -----
barnes-hut 2.6 3.7
checksum 0.7 0.8
count-graphs 1.9 3.0
DLXSimulator 4.1 7.0
fft 1.3 1.8
fib 0.6 0.7
hamlet 54.2 130.0
knuth-bendix 2.5 5.1
lexgen 5.8 10.6
life 1.5 2.5
logic 7.6 20.3
mandelbrot 0.7 0.8
matrix-multiply 0.7 0.8
md5 2.9 2.2
merge 0.7 0.8
mlyacc 20.3 40.1
mpuz 0.9 1.3
nucleic 4.0 4.6
peek 1.1 1.5
psdes-random 0.7 0.8
ratio-regions 2.7 3.9
ray 3.4 6.0
raytrace 10.1 17.7
simple 6.8 14.6
smith-normal-form 7.8 68.4
tailfib 0.6 0.7
tak 0.6 0.7
tensor 3.0 4.1
tsp 1.7 2.4
vector-concat 0.7 0.8
vector-rev 0.7 0.8
vliw 12.8 25.3
wc-input1 1.7 2.7
wc-scanStream 1.8 2.9
zebra 5.1 14.5
zern 1.1 1.4


--
Posted from firewa...@magrathea.epr.com [198.3.163.3]
via Mailgate.ORG Server - http://www.Mailgate.ORG

Greg Michaelson

unread,
Aug 16, 2001, 11:20:16 AM8/16/01
to
Majid Ghaderi (ghad...@yahoo.com) wrote:

: I am looking for a tool which can convert Sml code to


: C/C++ source code and run under x86 machines with
: Linux or Windows installed. I have found Sml2C but it
: is not designed to run on x86 machines.

There's a brand of Objective Caml called, I think, Camlot which generates
C from Caml. Caml and ML are pretty close. Have a look at the SML FAQs
for details of obtaining Caml.

Greg Michaelson

[H]omer

unread,
Aug 27, 2001, 8:49:59 PM8/27/01
to
I was a student at Heriot-Watt in 91/92, doing a Bsc. Comp. Sci.
I remember your lectures and using SML for Ceilidh in the 1st year lab.
Although I never really did get into SML professionally nor as a hobby,
the language left quite an impression on me. There is something very elegant
about it, and I was always impressed by its inherent ability to be used to
"prove" statements. I believe you described it as a "self-proving language".

I'd very much like to get back into SML. I still have that textbook by Ake
Wikstrom, "Functional Programming Using Standard ML" and all my old
course notes. Where should I go from there if I want to get into a MS
Windows specific environment and integrate OS library calls? I'd like to
start with a very simple interpreter first, then move up to a full windows
toolkit (if there is such a thing).

I also have a linux box here (RedHat linux 7.1), would it be easier for me
to forget about SML on Windows and just concentrate on the linux version?

Regards,

Keith G. Robertson-Turner
k g r @ n i l d r a m . c o . u k
(former stoo-dent)

"Greg Michaelson" <gr...@cee.hw.ac.uk> wrote in message
news:9lgobg$kiv$1...@cantaloupe.srv.cs.cmu.edu...

0 new messages