[erlang-questions] Fwd: Is there a good source for documentation on BEAM?

Richard O'Keefe <>
Tue May 8 08:05:12 CEST 2012


On 8/05/2012, at 5:35 PM, Michael Turner wrote:

> "(b) We learn only at the end of those 5 pages that there are
> really TWO different things called BEAM:
>       - the 'high level abstract instructions' generated
>         by the compiler, which is pretty stable, and
>       - the 'internal form' meant for execution, generated
>         by the loader, which 'has changed many times'."
> 
> Then there's the recommendation I read somewhere (I believe by a HiPE
> implementor) that it makes more sense to target Core Erlang. So, in a
> way, there are three levels you could target, two of them plausibly
> called "BEAM".

If you want to compile an extended syntax into something that is
already supported in Core Erlang, no worries.  For example,
implementing list comprehensions with out-of-line code, as
currently done, could be done that way.

If you want to compile list comprehensions into inline code,
I believe it can be done using high-level BEAM, but you can't
do it through Core Erlang.

If you want to compile something like frames, you need to
 - extend HiPE if you want the new feature to go fast *and*
 - extend low level BEAM *and*
 - extend high level BEAM *and*
 - extend Core Erlang *and*
 - extend source Erlang (probably the easiest step) *and*
 - extend the AST form (not too hard) *and*
 - extend the tools that process the AST form *and*
 - last but very much not least, you need to
   extend the documentation.

The more levels you have the harder it gets, unless the design
is very modular.  Here I will say that Quintus never really
got this as organised as they should have.  Adding a new
instruction required editing upwards of a dozen files.

The nearest I've seen to a well-structured emulator was the
Icon one, where the various C files that were used were generated
from an annotated master.





More information about the erlang-questions mailing list