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

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.
  • The AST nodes are very similar to the ones found in the JDT plugin for Eclipse. They still don't have bindings, though.
  • And ASTView plugin to see the AST tree built by the plugin.
  • 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 get it?

1. Run Eclipse. 2. Goto "Help -> Software updates -> Find and install..." and click Next. 3. Select "Search for new features to install" and click Next. 4. Click "New remote site...". 5. Enter "Descent" in the name field. 6. Enter "http://svn.dsource.org/projects/descent/trunk/descent.update-site/" in the URL field. 7. Click Ok. 8. Click Finish. 9. From here, check all the checkboxes found, and click Next. 10. Accept the license agreement and click Next, and then finish.

After the plugin installs, restart Eclipse.

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.

Now you can only play with the plugin to see some of it's functionality and help discovering bugs. For this, the plugin includes a view called "ASTView" similar to the one found in the JDT plugin. To open it, go to "Window -> Show View -> Other... -> D -> ASTView". Once you have an open D editor (a file with .d extension in a D project in the src folder), clicking the green button in the ASTView shows you the current AST tree.

If you see some red nodes it means something is wrong. If you find anything strange, please report it. Thanks.

Documentation

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

But most is in the following sections.

What to do next?

Now we are focusing in:

  • Making the build and launch system.
  • Updating the Parser and AST nodes for error recovery (while parsing).
  • Testing the parser with syntax errors.

How to help?

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.core.dom). Of course every referenced class also, but transformed into an ASTNode: this includes source range information. The model was changed a bit to reflect better the source code. TODO: link to the documentation.

To make sure the parsing and building of the AST tree work well, 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 Coverlipse. I'd like to get a %100 coverage on Parser.java and Lexer.java.

People interested in helping me, soon you'll be able to download a copy of the plugin right into your Eclipse, see the ASTView and play with it to find bugs.

Ary