<story><title>A Brief History of the BEAM Compiler</title><url>http://blog.erlang.org/beam-compiler-history/</url></story><parent_chain><item><author>ryanianian</author><text>I&amp;#x27;m always surprised and delighted to see so many &amp;quot;first implementations&amp;quot; of languages in prolog. It was described to me in college as &amp;quot;just a novelty&amp;quot; but in fact it&amp;#x27;s used extensively in the JVM internals [1] and apparently is the starting-point impl for other languages.&lt;p&gt;But prolog still seems so..awkward. I wonder why langs like Haskell or OCaml aren&amp;#x27;t more de-facto for these purposes; they seem to have similar expressive power for parser&amp;#x2F;grammar things and with less inside-out paradigms (imho).&lt;p&gt;[1] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;docs.oracle.com&amp;#x2F;javase&amp;#x2F;specs&amp;#x2F;jvms&amp;#x2F;se8&amp;#x2F;jvms8.pdf&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;docs.oracle.com&amp;#x2F;javase&amp;#x2F;specs&amp;#x2F;jvms&amp;#x2F;se8&amp;#x2F;jvms8.pdf&lt;/a&gt;</text></item></parent_chain><comment><author>segmondy</author><text>&amp;quot;seem so..awkward&amp;quot;?  Sure because you don&amp;#x27;t understand prolog.  it&amp;#x27;s very easy to implement languages.&lt;p&gt;Look how simple I can compile down to asm code in 35 lines of pure prolog code.&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;segmond&amp;#x2F;PrologThingz&amp;#x2F;blob&amp;#x2F;master&amp;#x2F;clause_and_effect&amp;#x2F;compilation&amp;#x2F;cg_flatten.pl&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;segmond&amp;#x2F;PrologThingz&amp;#x2F;blob&amp;#x2F;master&amp;#x2F;clause_a...&lt;/a&gt;&lt;p&gt;&lt;pre&gt;&lt;code&gt;  &amp;#x2F;*
  	c := 1;
  	r := 1;
  	while c &amp;lt; n do
  	     (c := c + 1;
  	      r := r * c)
  *&amp;#x2F;
  program(1, (
      assign(c,1);
      assign(r,1);
         while((c &amp;lt; n),
  	  (assign(c, c+1);
             assign(r, r*c))))).

  ?- compile(1).
    movc(1,r(1))
    stm(r(1),c)
    movc(1,r(1))
    stm(r(1),r)
  label(_G3638)
    movm(c,r(1))
    movm(n,r(2))
    cmp(1,2)
    bge(1)
    movm(c,r(1))
    movc(1,r(2))
    add(r(2),r(1))
    stm(r(1),c)
    movm(r,r(1))
    movm(c,r(2))
    mul(r(2),r(1))
    stm(r(1),r)
    br(_G3638)
  label(1)&lt;/code&gt;&lt;/pre&gt;</text></comment>
<story><title>A Brief History of the BEAM Compiler</title><url>http://blog.erlang.org/beam-compiler-history/</url></story><parent_chain><item><author>ryanianian</author><text>I&amp;#x27;m always surprised and delighted to see so many &amp;quot;first implementations&amp;quot; of languages in prolog. It was described to me in college as &amp;quot;just a novelty&amp;quot; but in fact it&amp;#x27;s used extensively in the JVM internals [1] and apparently is the starting-point impl for other languages.&lt;p&gt;But prolog still seems so..awkward. I wonder why langs like Haskell or OCaml aren&amp;#x27;t more de-facto for these purposes; they seem to have similar expressive power for parser&amp;#x2F;grammar things and with less inside-out paradigms (imho).&lt;p&gt;[1] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;docs.oracle.com&amp;#x2F;javase&amp;#x2F;specs&amp;#x2F;jvms&amp;#x2F;se8&amp;#x2F;jvms8.pdf&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;docs.oracle.com&amp;#x2F;javase&amp;#x2F;specs&amp;#x2F;jvms&amp;#x2F;se8&amp;#x2F;jvms8.pdf&lt;/a&gt;</text></item></parent_chain><comment><author>PaulHoule</author><text>The &amp;quot;inside out&amp;quot; paradigm of Prolog is what it is good for.  Try to write complex procedural programs and you will be driven to insanity by the cuts,  using logical failure to express procedural success,  etc.&lt;p&gt;The original sin of conventional programming languages is that we write a sequence of operations that happen one after another in time.  Thus we find concurrency,  dealing with asynchronous events,  and reacting effectively to the environment difficult.&lt;p&gt;Prolog makes writing simple parsers simple.  Certain kinds of search problems are easy to solve,  and some kinds of operations (say involving transitive closure) can be defined in two or three lines of Prolog that hopefully you could implement in 50 lines in a more normal language after looking at an algorithms book.&lt;p&gt;There has been a huge amount of research and commercial implementation of things that are like Prolog but different,  for instance having built-in satisfaction solving,  combinatorical optimization,  etc.  Prolog is backwards-chaining (finds rules to justify a conclusion) but other engines are forward chaining like Drools,  the Jena Rules Engine,  IBM iLog.&lt;p&gt;I would love to see this approach get more popular.</text></comment>