Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

When a program doesn't compile, error messages are sometimes esoteric. Often a simple Google search leading to a site like stack exchange solves the problem. Now why can't we automate this?

How about a Siri for coding? By Siri, I mean an intelligent personal assistant. Not talking about speech recognition here.

I wonder if there is anybody out there (startups/ research labs) building a cool product like this. It will cut down debugging time drastically.

share|improve this question
Have you ever used Eclipse? For some types of compiler errors, it tries to suggest fixes, such as adding the proper import statement, fixing build paths, etc... and if you click the little button beside the suggestion, it can (in some cases) implement the suggestion such as adding/removing import statements. There are limits to what it can do, of course, but it's nice to have and makes some types of compiler errors much less tedious to deal with. –  FrustratedWithFormsDesigner Jul 10 '13 at 15:10
Have you tried using any static analysis tools on your source before compiling? Most IDEs will auto compile as you type (or save), and the errors should be obvious within a line or two (and even get built in suggestions from the IDE). When it isn't something "trivial", how many different possible meanings of the source are there? –  MichaelT Jul 10 '13 at 15:11
Debugging is by far more demanding process than fixing typos. –  SK-logic Jul 10 '13 at 15:14
The Eclipse feature is called "Quick Fix", see more here: See wiki.eclipse.org/FAQ_What_is_a_Quick_Fix%3F –  FrustratedWithFormsDesigner Jul 10 '13 at 15:16
See programmers.stackexchange.com/a/30242/7043 –  delnan Jul 10 '13 at 15:22

2 Answers 2

Compilers cannot divine your intent, that's why.

Have you ever gotten some obscure error like

Cannot infer the type of x

only to find out you were missing a semicolon or comma? That's because the compiler doesn't have something it needs (a critical token), but it doesn't know why. If it can't figure that out, how's it supposed to figure out that you really do need that cast?

Naturally, we can write better compilers. But it's an ongoing work in progress, and I suspect that the quality of the language design has a lot to do with it. Static typing and compile-time assertions are probably the most promising ways to give the compiler the ability to check for errors.

See Also

share|improve this answer
The compiler can, however do far better than say "cannot infer the type of x". Off the top of my head, it could have a large Beisian net for computing the conditional probabilities of various error causes, given the whole program written. –  Don Reba Jul 11 '13 at 1:50

It's been done, long ago. The Cornell PL/C compiler for the PL/I language, auto-fixed any problems it found, with the goal of always producing a compilable and runnable program, no matter how little it resembled the original input. Some of the changes were simple, and made good sense. Others were not. It was a common joke at the time to drop a deck of randomly-selected punched cards into PL/C and see what happened :-)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.