|Version 5 (modified by p_tanski, 10 years ago) (diff)|
GHC Commentary: What the hell is a .cmm file?
A .cmm file is rather like C--. The syntax is almost C-- (a few constructs are missing), and it is augmented with some macros that are expanded by GHC's code generator (eg. INFO_TABLE()). A .cmm file is compiled by GHC itself: the syntax is parsed by compiler/cmm/CmmParse.y and compiler/cmm/CmmLex.x into the Cmm data type, where it is then passed through one of the back-ends.
We use the C preprocessor on .cmm files, making extensive use of macros to make writing this low-level code a bit less tedious and error-prone. Most of our C-- macros are in includes/Cmm.h.
For more information on Cmm (GHC's implementation of C--), see the Cmm language page.