Hawk
Hawk

Reputation: 5170

How visual studio compiler identifies syntax error before we run it

We know that the compiler is responsible for identifying syntax errors (with the linker). Logically, the compilation phase starts when we run the program by pressing run button or F7. However, we notice the recent versions of visual studio, the compiler can identify some errors (e.g. underlines undefined functions in red) before even we run to test the code. My question is how does that happen? does the compiler operate in the background during the editing phase?

Upvotes: 0

Views: 357

Answers (1)

librik
librik

Reputation: 3788

Microsoft's Intellisense uses a tool called the EDG C++ Front End, which is basically the first half of the Edison Design Group C++ Compiler. EDG's program is pretty famous in the compiler world for understanding unfinished source code -- things like "you forgot a semicolon" and "that line is bad, but I can get back in sync for the next line." But it is a different compiler technology than Visual C++ (as a compiler, it's not as good), so occasionally you will get a warning in Intellisense about code that is totally fine when you press F7 ("Compile").

Upvotes: 1

Related Questions