Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.
Version 14 (modified by PsychoBrat, 17 years ago)
fixed a bracket

Welcome to Descent

The aim of this project is to provide an Eclipse plugin for writing code in the D programming language from Digital Mars.

The idea is to port DMD source code to Java, and from this build all other functionalities. Instead of using some language processing tool like ANTLR, this has the following advantages:

  • Not having to understand the syntax in the digital mars webpage, which is constantly changing at a very speed rate.
  • Updates to the language are easily adopted by the plugin: just diff it :-)
  • No need to think of a model: Walter already took care of that.

What is done?

  • Ported most of DMD lexer and parser code, and statement covered by tests by %85 percent.
  • Added source range information to the classes in the model.
  • Simple syntax errors are marked in the code (not just the line number, but the exact position)
  • Syntax highlighting (colors still not configurable).
  • Outline View (still not fully functional)
  • Compiles source files with "-c" automatically to a bin folder, using "dmd" set on the environment path (need to make a workspace preference and use it).

How to use it?

Currently only developers can test the project, still it is not useful yet. Then:

  1. Grab a copy of the source from the SVN repository.
  2. Open Eclipse. Go to File -> Import. There, select General -> Existing Project into Workspace.
  3. Select the directory where the source code is located.
  4. Right click on the "descent.ui" project, select Run As -> Eclipse Application.

Go to "File -> New -> Project". In the "D" category select "D Project", enter it's location and hit OK. You *must* create files under the "src" folder. If automatic build is enabled, when you save a file it is compiled to the "bin" folder using "dmd" command found in the environment path.

Now you can only play with the plugin to see some of it's functionality and help discovering bugs.

A note: when you are editing a file you should see the simple syntax errors marked in the editor. If you save a file, the plugin asks DMD to compile it, gets the errors outputed from DMD and shows them in the editor. This is not a bug. Once the plugin is able to figure out all errors this behaviour will be droped.

Documentation

Some documentation is here: http://www.prowiki.org/wiki4d/wiki.cgi?DescentUI

But most is in the following sections.

What to do next?

These three are almost done:

  • Finish porting the lexer and parser code.
  • Get a (close to) %100 coverage with unit tests on the lexer and parser.
  • Finish making unit tests for each element in the model.

Now we are focusing in:

  • Changing the model to look like the AST model of JDT. If it worked for them, it should work for us. :-)
  • Making the build and launch system.

How to help?

TODO: This needs to be updated.

I'll explain a bit how descent.core is done, and what needs to be done in order to continue.

I grabbed Walter's source code of lexer.h, lexer.c, parser.h and parser.c from DMD and ported them to Java (package descent.internal.com.dom). Of course every referenced class also, but just superficialy: just what needed to be coded so that the parser and lexer compile.

Now, since this plugin will present a user interface and give actions to specific parts of the code, we need to know where each element in the abstract syntax tree (AST) is located in the code. DMD doesn't do that (it just records the line number so that errors are more easily spotted), so this has to be added to the Java code. Most of this is done, but not the whole of it.

The other thing to be done is present to the user (to the programmer) a nice and clean interface to the AST. This is package descent.core.dom. There are some interfaces not there yet: they have to be done.

To make sure the interfaces work well, and that positions are correct, I've made a bunch of tests (descent.tests). Each test parses a piece of source code into the AST presented as interfaces, and tests what said before. To see how much is covered by the tests I use Coverclipse. I'd like to get a %100 coverage on Parser.java and Lexer.java.

Developers interested in helping me, some more interfaces from the AST must be introduced and tested.

Ary