The differences between Cmm parser and pretty printer

Hello back

One of the goals of my GSoC cmm project is to make cmm roundtripable. That is , be able to serialize/pretty print the cmm data structure ( the one GHC uses for code generation ) into a file and be able to parse/deserialize said file back into a haskell data structure. This is currently not possible because Cmm cant be pretty printed and parsed from textual files. But those two tools use incompatible formats

Initially Csaba Hruska ( my mentor ) and i figured out the least invasive way to accomplish this, would be to rewrite the pretty printer so it produces code compatible with the parser. But we now think this is a bad idea. The parser implements a “high level syntax” which ammount to features not found in the cmm data structure. But even the low level syntax is not an accurate depiction of the AST.

I would like to share some of the documentation i have been writing, so you can see for yourselfs

2 Likes

For those interested there was also discussion on the ghc-devs mailing list in these two threads:

1 Like

Thanks. forgot to link those. There is also a third mailing list thread ( there is more than one because i messed up the format )

and a couple of ( mildly ) related threads :

I would like some feedback on the style of documentation i am writing

I find it hard to see the structure of the documentation itself. Perhaps an introduction with an overview of the contents could help?

2 Likes

My dyslexic ass forgot to improve the redaction. It should be better now , but i could try another cleaning pass