You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #210 it came up multiple times that OCaml's standard Format module could replace Pretty from CIL with additional benefits:
It's maintained in OCaml's standard library while Pretty isn't properly maintained (maybe we should do this migration even in our CIL fork eventually).
It has much more features for producing pretty output.
It's supposed to be faster by not constructing Pretty.doc structures but writing to a formatter directly (a la how Printable.printXml currently works).
It allows custom semantic tags, e.g. for colors, and their behavior can depend on where the output is going (to the terminal or to a string).
TODO
Replace Printable.pretty with val pp: Format.formatter -> t -> unit. This is the de facto standard naming for these pretty printer and deriving show also derives this signature.
Rewrite every implementation of pretty as pp.
Rewrite every Pretty.printf with Format.printf by using pp instead of pretty.
Rewrite tracing system to use Format instead of Pretty.
Rewrite every trace by using pp instead of pretty.
Implement pp for CIL types, e.g. pp_exp to replace d_exp. CIL has a lot of Pretty-based code to pretty-print everything (including entire programs). We don't need all of it though unless we also decide to migrate CIL itself.
In #210 it came up multiple times that OCaml's standard
Formatmodule could replacePrettyfrom CIL with additional benefits:Prettyisn't properly maintained (maybe we should do this migration even in our CIL fork eventually).Pretty.docstructures but writing to a formatter directly (a la howPrintable.printXmlcurrently works).Obj(Possibly excessive functions inPrintable.S#210 (comment)).ppx_deriving.stdhasderiving showthat also derives a pretty-printer in addition to a simpleshow(Possibly excessive functions inPrintable.S#210 (comment)).TODO
Printable.prettywithval pp: Format.formatter -> t -> unit. This is the de facto standard naming for these pretty printer andderiving showalso derives this signature.prettyaspp.Pretty.printfwithFormat.printfby usingppinstead ofpretty.Formatinstead ofPretty.traceby usingppinstead ofpretty.ppfor CIL types, e.g.pp_expto replaced_exp. CIL has a lot ofPretty-based code to pretty-print everything (including entire programs). We don't need all of it though unless we also decide to migrate CIL itself.