[ZT]为新语言开发IDE

Implementing Support for Your Own Language

Through its JDT project, Eclipse has strong support for Java development, such as editing, refactoring, building, launching, and debugging. Likewise, the C development tools (CDT) project aims for similar support for writing C/C++ code. This chapter discusses some of the issues to address when you have your own language and want to host it in Eclipse for writing programs and plug-ins. We look at the various ways of integrating with Eclipse: from no integration to a fully integrated language development environment. To structure our discussion, we take a closer look at eScript, an experimental script language developed especially for this book. As is the case for all examples described in this book, you can find eScript on this book’s CD-ROM or Web site (http://eclipsefaq.org).

Many questions have been addressed in other FAQs in this book and may be somewhat repetitive. However, if you are planning to implement support for your own programming language, this chapter might serve well as a comprehensive overview of how to approach this big task.

Any classification of integration of a new programming language with Eclipse is somewhat arbitrary. We have identified the following degrees of integration of a new programming language, such as eScript, with Eclipse:

  • Phase 1—Compiling code and building projects. To obtain full integration with Eclipse in the area of compilation of programs and build processes for your own language, follow the various steps outlined in the FAQs below.
  • Phase 2—Implementing a DOM. The DOM is an in-memory structural representation of the source code of a program written in your language. Using the structural information contained in the DOM, all kinds of analysis and refactoring tools can be built.
  • Phase 3—editing programs. After writing a compiler, a builder, and a DOM, you are ready to consider all the individual steps to build the ultimate Eclipse editor for your language.
  • Phase 4—Adding the finishing touches. To give your language IDE a professional look, follow the steps outlined in the FAQs below.

If you carefully observe these four phases, you will find that the visual aspects of your language IDE happen late in the process. You will have to do some legwork before you are able to get to the pretty parts. We recommend patience and restraint. Time spent in phases 1 and 2 will be well spent, and once you get to phase 3 and 4, you will be grateful that you followed all the steps we outlined.

  • FAQ What is eScript?
  • FAQ Language integration phase 1: How do I compile and build programs?
  • FAQ How do I load source files edited outside Eclipse?
  • FAQ How do I run an external builder on my source files?
  • FAQ How do I implement a compiler that runs inside Eclipse?
  • FAQ How do I react to changes in source files?
  • FAQ How do I implement an Eclipse builder?
  • FAQ Where are project build specifications stored?
  • FAQ How do I add a builder to a given project?
  • FAQ How do I implement an incremental project builder?
  • FAQ How do I handle setup problems for a given builder?
  • FAQ How do I make my compiler incremental?
  • FAQ Language integration phase 2: How do I implement a DOM?
  • FAQ How do I implement a DOM for my language?
  • FAQ How can I ensure that my model is scalable?
  • FAQ Language integration phase 3: How do I edit programs?
  • FAQ How do I write an editor for my own language?
  • FAQ How do I add Content Assist to my language editor?
  • FAQ How do I add hover support to my text editor?
  • FAQ How do I create problem markers for my compiler?
  • FAQ How do I implement Quick Fixes for my own language?
  • FAQ How do I support refactoring for my own language?
  • FAQ How do I create an Outline view for my own language editor?
  • FAQ Language integration phase 4: What are the finishing touches?
  • FAQ What wizards do I define for my own language?
  • FAQ When does my language need its own nature?
  • FAQ When does my language need its own perspective?
  • FAQ How do I add documentation and help for my own language?
  • FAQ How do I support source-level debugging for my own language?

你可能感兴趣的:([ZT]为新语言开发IDE)