Does anyone have a reference to a poster/one-page pdf or something similar with a list of the eight phases of translation for the C language (the first one being trigraph translation)? I want to have one printed hanging on my wall next to my pc.
Update: Sorry for forgetting to specify. I am interested in C90 (although C99 probably is pretty close, _Pragma
as mentioned in pmg's answer is C99 specific and I would like to avoid that).
ASCII art for the win:
ANSI C translation phases
=========================
+-------------------------------------------------+
| map physical characters to source character set |
| replace line terminators with newlines |
| decode trigraph sequences |
+-------------------------------------------------+
|
V
+---------------------------------------+
| join lines along trailing backslashes |
+---------------------------------------+
|
V
+-------------------------------------------------------------+
| decompose into preprocessing tokens and whitespace/comments |
| strip comments |
| retain newlines |
+-------------------------------------------------------------+
|
V
+------------------------------------------------+
| execute preprocessing directives/invoke macros |
| process included files |
+------------------------------------------------+
|
V
+----------------------------------------------------------------+
| decode escape sequences in character constants/string literals |
+----------------------------------------------------------------+
|
V
+--------------------------------------+
| concatenate adjacent string literals |
+--------------------------------------+
|
V
+------------------------------------------+
| convert preprocessing tokens to C tokens |
| analyze and translate tokens |
+------------------------------------------+
|
V
+-----------------------------+
| resolve external references |
| link libraries |
| build program image |
+-----------------------------+
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With