<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>That's what I've just done :D Core Erlang looks very verbose but quite regular & probably not difficult to generate. </div><div><br></div><div>My questions now are:</div><div>- are there any libraries "out there" for generating Core Erlang, or do we all roll our own?</div><div>- how would one use compile:file or compile:forms with core erlang? I haven't been able to find any documentation (haven't read Richard Carlsson's Introduction paper yet).</div><div><br></div><div>Many thanks</div><div><br></div><div>Ivan<br><br>--<br>festina lente<div><br></div></div><div><br>On 29 Sep 2013, at 18:36, Erik Søe Sørensen <<a href="mailto:eriksoe@gmail.com">eriksoe@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><p dir="ltr">Core Erlang is an intermediate representation in the Erlang compiler - but also (afaik) a fairly well-defined/public one and one that is stable.<br>
I don't think you'll find much in the vein of tutorials. Try getting erlc to output the intermediate format, though, for a small program similar to what you'll be using it for.</p>
<div class="gmail_quote">Den 29/09/2013 19.20 skrev "Ivan uemlianin" <<a href="mailto:ivan@llaisdy.com">ivan@llaisdy.com</a>>:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="auto"><div>Thanks! I think I'll try and head in that direction. I've had a few goes at other methods (db lookup etc) and they're much slower than this "dynamic hardcoding"). I'll sniff around for Core Erlang tutorials.</div>
<div><br></div><div>Best wishes</div><div><br></div><div>Ivan</div><div><br><br>--<br>festina lente<div><br></div></div><div><br>On 29 Sep 2013, at 17:48, Erik Søe Sørensen <<a href="mailto:eriksoe@gmail.com" target="_blank">eriksoe@gmail.com</a>> wrote:<br>
<br></div><blockquote type="cite"><div><p dir="ltr">A thing which I discovered recently (in connection with mochiglobal) is that compiling code containing large binaries, or large amounts of binaries, is quite memory-intensive. As I recall it, the numbers were ~64 bytes of RAM per byte in a binary metal; twice as much if on a 64 bit emulator.<br>
Which means that if you want to compile modules containing (in sum) multimegabyte binaries, doing so from Erlang source or from full Erlang AST is a no-go. Iirc, it is feasible if starting from Core Erlang.<br>
/Erik </p>
<div class="gmail_quote">Den 29/09/2013 12.50 skrev "Ivan Uemlianin" <<a href="mailto:ivan@llaisdy.com" target="_blank">ivan@llaisdy.com</a>>:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear Anthony<br>
<br>
Thanks for your comment.<br>
<br>
Yes, that's exactly what the generated module is doing. The generated module has a single function with many clauses like this:<br>
<br>
f(<<"trigger", Rest/binary) -> ...<br>
<br>
This is why (as far as I can work out) the generated code has to be so big.<br>
<br>
I prefer the idea of generating and loading code to, say, updating a database table, because it seems faster and less likely to lead to bottlenecks.<br>
<br>
Best wishes<br>
<br>
Ivan<br>
<br>
<br>
On 29/09/2013 11:38, Anthony Ramine wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello Ivan,<br>
<br>
Out of curiosity, what does it look like?<br>
<br>
Pattern matching on literal values in Erlang is done with a binary search over the sorted list of patterns, I am not sure this would play well with your use case even if the compilation didn't bring the VM down.<br>
<br>
Regards,<br>
<br>
Le 29 sept. 2013 à 11:29, Ivan Uemlianin a écrit :<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
All goes well on small test files, but the files I want to use IRL are relatively large --- around 120,000 lines.<br>
</blockquote>
<br>
</blockquote>
<br>
-- <br>
==============================<u></u>==============================<br>
Ivan A. Uemlianin PhD<br>
Llaisdy<br>
Speech Technology Research and Development<br>
<br>
<a href="mailto:ivan@llaisdy.com" target="_blank">ivan@llaisdy.com</a><br>
<a href="http://www.llaisdy.com" target="_blank">www.llaisdy.com</a><br>
<a href="http://llaisdy.wordpress.com" target="_blank">llaisdy.wordpress.com</a><br>
<a href="http://github.com/llaisdy" target="_blank">github.com/llaisdy</a><br>
<a href="http://www.linkedin.com/in/ivanuemlianin" target="_blank">www.linkedin.com/in/<u></u>ivanuemlianin</a><br>
<br>
festina lente<br>
==============================<u></u>==============================<br>
______________________________<u></u>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br>
</blockquote></div>
</div></blockquote></div></blockquote></div>
</div></blockquote></body></html>