Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

closed as too broad by Snowman, gnat, GlenH7, durron597, TZHX Nov 4 '15 at 8:57

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the 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? – user40980 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 – FrustratedWithFormsDesigner Jul 10 '13 at 15:16
See – delnan Jul 10 '13 at 15:22

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

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