The legacy IRs implemented pretty-printing by converting the code into a Scala AST and then using the Scala pretty-printer!
Not ideal because it's slow, and because Scala's pretty-printer can be glitchy.
The new pretty-printer should:
- break lines only if necessary (can take inspiration from this);
- print variables as original name +
'_' + counter starting from 0 (to avoid clashes);
- ideally, have a notion of precedence and associativity to avoid some parentheses;
- ideally, be reusable (implemented as a
Base), but with hooks to help print virtualized constructs such as if then else correctly (instead of as squid.lib.IfThenElse).
The legacy IRs implemented pretty-printing by converting the code into a Scala AST and then using the Scala pretty-printer!
Not ideal because it's slow, and because Scala's pretty-printer can be glitchy.
The new pretty-printer should:
'_'+ counter starting from 0 (to avoid clashes);Base), but with hooks to help print virtualized constructs such asif then elsecorrectly (instead of assquid.lib.IfThenElse).