-
Notifications
You must be signed in to change notification settings - Fork 325
Implement Display trait for AST types #1
Description
I want to propose implementing the Display trait for all of the AST types to easily convert from AST to human readable wat/wast. I volunteer to implement this.
I am in the design phase of writing a language which is a strict extension of wat and wast (https://github.com/vitiral/wak-lang) and so would like to use this crate. However, one of the debug implementations of my compiler will be to export commented wat code so it is clear how code was generated. For instance:
32
Might "compile" into
(;(;@1:0;) 32;)
(i32.const 32)
(where (;@1:0;) is a nested comment representing the line number where the source code starts)
In order to implement this, I need all wat types to be printed to human-readable wat source. Obviously I could create my own traits and implement all the types into that, but I think this would be generally useful for other users of this crate.
Thanks!