Better pretty-printing #968
Closed
pieter-bos
started this conversation in
Ideas
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The current printer was invented ad-hoc and does not work very well: it contains a state machine with 200 lines of definitions and still does not print whitespace correctly. I think this is a promising method for pretty-printing. We should adapt it a bit for our case:
Doc
?Doc
is for a particularNode
, perhaps we can just have a case for a non-layout-affectingnode :: Node -> Doc -> Doc
. This would hopefully allow us to print[----
/----]
bars around a node within a printed AST.//@ ghost x = 1 + \old(x)
should be printed in ghost again, but only because\old
appears in it: assignment and addition are of course supported outside of ghost code. Alternatively we could ignore this entirely and insist that the AST indicates whether something is ghost or not structurally.Beta Was this translation helpful? Give feedback.
All reactions