C  Flavoured Erlang???<br><br>Converting existing C projects to such a language would be a challenge. Even if you could transform the language elements, calls to standard libraries would need to be replaced with OTP.<br><br>
<br><div class="gmail_quote">2008/11/13 Alceste Scalas <span dir="ltr"><<a href="mailto:alceste@crs4.it">alceste@crs4.it</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Il giorno lun, 10/11/2008 alle 21.33 +0100, Robert Virding ha scritto:<br>
> Yes, it would be possible [to compile C in Core Erlang] but there<br>
<div class="Ih2E3d">> would be quite severe restrictions on the C you could write. Three<br>
> main ones are:<br>
><br>
> - no destructive operations on data as all data is immutable in Erlang<br>
<br>
</div>You could simulate destructive operations by using fresh variables.  In<br>
other words, you could convert your C code into SSA (Static Single<br>
Assignment) form [1] and then compile it almost directly into Core<br>
Erlang.<br>
<br>
That's what we are doing for compiling a Matlab-like language into Core<br>
Erlang.  See [2].<br>
<br>
<br>
> - global data is tricky<br>
<br>
...and very slow (you could simulate global variables using a server<br>
process).<br>
<div class="Ih2E3d"><br>
<br>
> - many of the basic C data structures don't map easily to Erlang<br>
<br>
</div>Furthermore, if you need something like pointer arithmetics, you will<br>
need to simulate the memory as a global variable.  Not very fun...<br>
<br>
Regards,<br>
<br>
alceste<br>
<br>
References:<br>
<br>
  [1] Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman,<br>
        and F. Kenneth Zadeck.  Efficiently computing static single<br>
        assignment form and the control dependence graph.  ACM<br>
        Transactions on Programming Languages and Systems (TOPLAS),<br>
        13(4):451-490, 1991.<br>
<br>
  [2] Alceste Scalas, Giovanni Casu and Piero Pili.  High-performance<br>
        Technical Computing with Erlang.  Presentation at the VII ACM<br>
        SIGPLAN Erlang Workshop, Victoria, British Columbia, Canada,<br>
        September 27, 2008.<br>
        <a href="http://www.erlang.org/workshop/2008/Sess23.pdf" target="_blank">http://www.erlang.org/workshop/2008/Sess23.pdf</a><br>
<font color="#888888"><br>
--<br>
Alceste Scalas <<a href="mailto:alceste@crs4.it">alceste@crs4.it</a>><br>
CRS4 - <a href="http://www.crs4.it/" target="_blank">http://www.crs4.it/</a><br>
</font><div><div></div><div class="Wj3C7c"><br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br>