News for hackers. Stuff that matters.
Re:A Peek Inside the Erlang Compiler (2012) by hkgumbs on Tuesday June 09, 2020 @08:03AM (#23465845)
A few years ago, I tried to use Core Erlang as a compiler backend. It's fairly straightforward to learn even without thorough documentation. I wrote a bit about my process to try to help the next person [0]. For my particular project, I ended up abbandoning the approach and generating BEAM bytecode instead [1]. That was definitely more challenging, but it was neat to see Erlang's commitment to backwards compatibility in action. I believe that BEAM modules emitted by the first versions of Erlang are still valid on modern implementations. New functions are added and old ones are deprecated, but the actual file format version indicator hasn't changed.

[0]: https://8thlight.com/blog/kofi-gumbs/2017/05/02/core-erlang....

[1]: https://github.com/hkgumbs/codec-beam

Re:A Peek Inside the Erlang Compiler (2012) by h91wka on Tuesday June 09, 2020 @01:46PM (#23468888)
Neat! But please bear in mind that BEAM VM trusts the bytecode, so if your compiler emits buggy bytecode, it can crash the entire VM.
Re:A Peek Inside the Erlang Compiler (2012) by macintux on Tuesday June 09, 2020 @08:53AM (#23466192)
Nice. I added your codec-beam project to my Erlang resources gist: https://gist.github.com/macintux/6349828