Is it possible to get clang or gcc to display the result of the lexing phase?
Clang reduces the single-thread compilation time by 5% to 10% compared with GCC. Therefore, Clang offers more advantages for the construction of large projects.
The lexer and parser together are often referred to as the compiler's front end. The rest of the compiler is called the back end.
Clang is much faster and uses far less memory than GCC. Clang aims to provide extremely clear and concise diagnostics (error and warning messages), and includes support for expressive diagnostics. GCC's warnings are sometimes acceptable, but are often confusing and it does not support expressive diagnostics.
The difference is that GCC supports a number of programming languages while LLVM isn't a compiler for any given language. LLVM is a framework to generate object code from any kind of source code. While LLVM and GCC both support a wide variety languages and libraries, they are licensed and developed differently.
Although the parser does poll the lexer without there being a proper "lexing phase" this does not mean that you cannot dump the tokens as they are lexed. This is done with the command :
clang -fsyntax-only -Xclang -dump-tokens code.c
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