Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

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

Say you have a language compiler you would like to build an IDE for.

How is auto completion, instant error reporting while writing code and debuggers commonly implemented?

share|improve this question

closed as not a real question by Jimmy Hoffa, Glenn Nelson, Robert Harvey, Walter, Mark Booth Mar 7 '13 at 18:13

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Far too broad a question to be effectively answered. – whatsisname Mar 6 '13 at 14:47
I'm no IDE author but I suspect this answer could vary wildly depending on the actual design of the language. – Erik Reppen Mar 6 '13 at 14:52
You could improve your question by narrowing the scope of what you're asking and focus on a particular aspect. Currently, you're asking about 3 very broad aspects of an IDE (auto-completion; error checking; and debugging). – GlenH7 Mar 6 '13 at 15:05
This is far too broad a question for Stack Exchange to cope with. – ChrisF Mar 6 '13 at 15:45
Given the high-level question, I think the existing answers are a good start toward a high-level explanation. Sure, we won't be able to provide explicit details without writing a book, but it seems okay to explain the concepts. – Corbin March Mar 6 '13 at 19:54
up vote 6 down vote accepted

In general, it's done:

  • By pre-compiling (or interpreting, depending on the language) the source code in background. Starting to compiling the code may result in errors which are then shown through the IDE interface back to the developer who can immediately fix them without compiling the app manually.

    You may also be interested in the beginning of the MSDN article on background compiler.

  • By analyzing the code, just like static analysis tools do it.

  • By running external tools which do something with source code. For example, in Visual Studio, Code Contracts checker runs at background and spawns warnings and informative messages in the Error List and draws squigglies (the violet lines beneath the code which are similar to red lines a text editor displays beneath mistyped words).

share|improve this answer

The IDE builds a semantic model of the program. Which is essentially the same thing a compiler does, minus the actual code generation part.

In many modern language implementations, the same code is reused for both tasks, this makes it easier to keep IDE features in sync with language features. For example, the Scala compiler is specifically designed in such a way that it can be easily plugged into an IDE. It even has a special mode, called the presentation compiler, which presents a semantic model to the IDE.

The other way around, JetBrains is currently designing and implementing a new programming language, because they already have the required compiler know-how from building their IDE.

And, of course, in the space where IDEs were invented, i.e. Lisp and Smalltalk, there is no difference between runtime, compile time and design time, programming and debugging, compiler and IDE, debugger and editor. They are all more or less the same thing.

share|improve this answer

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