(From memory, don't quote me on this), The BEAM bytecode is apparently not well documented, so the standard practice for compile-to-beam languages is to emit Erlang terms, then use the erlang toolchain to compile down to bytecode. I think that's how Elixir and LFE do it anyways.