Compile to Erlang abstract format #3705
lpil
started this conversation in
Ideas & suggestions
Replies: 2 comments 7 replies
-
I really love to see the intermediate Erlang, It helps me:
I'd love to have correct line numbers for crashes but would prefer if the source maps would be added to via beam patches somehow if possible for the reasons above. |
Beta Was this translation helpful? Give feedback.
3 replies
-
That sounds interesting, I have just a couple of questions since I'm not too familiar with the abstract format and how it works:
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently we compile to Erlang source. This means that when there is a runtime error the line numbers in the stack trace are incorrect.
Erlang abstract format is the data structure that Erlang parses to. https://www.erlang.org/doc/apps/erts/absform.html
If we targeted this then we would be able to annotate the generated code with line numbers, making stack traces accurate.
The Erlang compiler exposes and API for compiling abstract forms, we could adapt our existing Erlang compiler code to use this.
If we target a textual representation of the abstract forms then they we may choose to forego pretty printing and gain some performance improvement as a result.
If we target a binary representation we may get better performance still but we would need to consider how to snapshot test this code. Likely we would need to implement some printer for it.
Are there other benefits or considerations?
This would be a large amount of work. A full rewrite of the Erlang code generator.
Beta Was this translation helpful? Give feedback.
All reactions