<div dir="ltr"><div><div>There's also just:<br><br></div>erlc +to_core foo.erl<br></div>erlc +from_core foo.core<br><br>Tom Murphy<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Sep 29, 2013 at 11:59 AM, Loïc Hoguin <span dir="ltr"><<a href="mailto:essen@ninenines.eu" target="_blank">essen@ninenines.eu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 09/29/2013 08:24 PM, Ivan uemlianin wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That's what I've just done :D  Core Erlang looks very verbose but quite<br>
regular & probably not difficult to generate.<br>
<br>
My questions now are:<br>
- are there any libraries "out there" for generating Core Erlang, or do<br>
we all roll our own?<br>
</blockquote>
<br></div>
Look at the cerl module. It's just a matter of generating the proper structure using those functions.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- how would one use compile:file or compile:forms with core erlang? I<br>
haven't been able to find any documentation (haven't read Richard<br>
Carlsson's Introduction paper yet).<br>
</blockquote>
<br></div>
Do read it. But to answer that question, compile:forms with from_core option.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Many thanks<br>
<br>
Ivan<br>
<br>
--<br>
festina lente<br>
<br>
<br>
On 29 Sep 2013, at 18:36, Erik Søe Sørensen <<a href="mailto:eriksoe@gmail.com" target="_blank">eriksoe@gmail.com</a><br></div>
<mailto:<a href="mailto:eriksoe@gmail.com" target="_blank">eriksoe@gmail.com</a>>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Core Erlang is an intermediate  representation in the Erlang compiler<br>
- but also (afaik) a fairly well-defined/public one and one that is<br>
stable.<br>
I don't think you'll find much in the vein of tutorials. Try getting<br>
erlc to output the intermediate format, though, for a small program<br>
similar to what you'll be using it for.<br>
<br>
Den 29/09/2013 19.20 skrev "Ivan uemlianin" <<a href="mailto:ivan@llaisdy.com" target="_blank">ivan@llaisdy.com</a><br></div>
<mailto:<a href="mailto:ivan@llaisdy.com" target="_blank">ivan@llaisdy.com</a>>>:<div class="im"><br>
<br>
    Thanks! I think I'll try and head in that direction. I've had a<br>
    few goes at other methods (db lookup etc) and they're much slower<br>
    than this "dynamic hardcoding"). I'll sniff around for Core Erlang<br>
    tutorials.<br>
<br>
    Best wishes<br>
<br>
    Ivan<br>
<br>
<br>
    --<br>
    festina lente<br>
<br>
<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><br></div>
    <mailto:<a href="mailto:eriksoe@gmail.com" target="_blank">eriksoe@gmail.com</a>>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
    A thing which I discovered recently (in connection with<br>
    mochiglobal) is that compiling code containing large binaries, or<br>
    large amounts of binaries,  is quite memory-intensive. As I<br>
    recall it, the numbers were ~64 bytes of RAM per byte in a binary<br>
    metal; twice as much if on a 64 bit emulator.<br>
    Which means that if you want to compile modules containing (in<br>
    sum) multimegabyte binaries, doing so from Erlang source or from<br>
    full Erlang AST is a no-go.  Iirc, it is feasible if starting<br>
    from Core Erlang.<br>
    /Erik<br>
<br>
    Den 29/09/2013 12.50 skrev "Ivan Uemlianin" <<a href="mailto:ivan@llaisdy.com" target="_blank">ivan@llaisdy.com</a><br></div>
    <mailto:<a href="mailto:ivan@llaisdy.com" target="_blank">ivan@llaisdy.com</a>>>:<div><div class="h5"><br>
<br>
        Dear Anthony<br>
<br>
        Thanks for your comment.<br>
<br>
        Yes, that's exactly what the generated module is doing.  The<br>
        generated module has a single function with many clauses like<br>
        this:<br>
<br>
            f(<<"trigger", Rest/binary) -> ...<br>
<br>
        This is why (as far as I can work out) the generated code has<br>
        to be so big.<br>
<br>
        I prefer the idea of generating and loading code to, say,<br>
        updating a database table, because it seems faster and less<br>
        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>
<br>
            Hello Ivan,<br>
<br>
            Out of curiosity, what does it look like?<br>
<br>
            Pattern matching on literal values in Erlang is done with<br>
            a binary search over the sorted list of patterns, I am<br>
            not sure this would play well with your use case even if<br>
            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>
                All goes well on small test files, but the files I<br>
                want to use IRL are relatively large --- around<br>
                120,000 lines.<br>
<br>
<br>
<br>
        --<br></div></div>
        ==============================<u></u>__============================<u></u>==<div class="im"><br>
        Ivan A. Uemlianin PhD<br>
        Llaisdy<br>
        Speech Technology Research and Development<br>
<br></div>
        <a href="mailto:ivan@llaisdy.com" target="_blank">ivan@llaisdy.com</a> <mailto:<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> <<a href="http://www.llaisdy.com" target="_blank">http://www.llaisdy.com</a>><br>
        <a href="http://llaisdy.wordpress.com" target="_blank">llaisdy.wordpress.com</a> <<a href="http://llaisdy.wordpress.com" target="_blank">http://llaisdy.wordpress.com</a>><br>
        <a href="http://github.com/llaisdy" target="_blank">github.com/llaisdy</a> <<a href="http://github.com/llaisdy" target="_blank">http://github.com/llaisdy</a>><br>
        <a href="http://www.linkedin.com/in/__ivanuemlianin" target="_blank">www.linkedin.com/in/__<u></u>ivanuemlianin</a><br>
        <<a href="http://www.linkedin.com/in/ivanuemlianin" target="_blank">http://www.linkedin.com/in/<u></u>ivanuemlianin</a>><br>
<br>
                                festina lente<br>
        ==============================<u></u>__============================<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> <mailto:<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@<u></u>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>
        <<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a>><br>
<br>
</blockquote></blockquote><div class="im">
<br>
<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>
<br>
</div></blockquote><span class="HOEnZb"><font color="#888888">
<br>
<br>
-- <br>
Loïc Hoguin<br>
Erlang Cowboy<br>
Nine Nines<br>
<a href="http://ninenines.eu" target="_blank">http://ninenines.eu</a></font></span><div class="HOEnZb"><div class="h5"><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>
</div></div></blockquote></div><br></div>