1

I want to look at the tokenized output my c-source code. The cpp processor first process the cpp-directives and then it tokenizes the c source code. Then the this tokenized output is parsed.

After that assembler does the job and process continues.

I have written my tokenizer using flex. I just want to see how gcc compiler tokenizes c source code.

Correct me if I am wrong.

Rishit Sanmukhani
  • 2,159
  • 16
  • 26

1 Answers1

3

GCC can output the result of the preprocessing step, and there is another option (intended for debugging the preprocessor) to show you details of the tokens:

gcc  -E  -fdebug-cpp  yourinpufile.c
Thomas Padron-McCarthy
  • 27,232
  • 8
  • 51
  • 75
  • I believe that the code of the c-tokenizer must have been written in flex, as flex and bison are used in GCC. Can I get the source code of the c-tokenizer? I want to understand how does gcc compiler works. – Rishit Sanmukhani Feb 07 '15 at 18:15