Spoofax/IMP
Spoofax/IMP is a platform for developing textual domain-specific languages (
DSLs) that can be distributed as Eclipse plugins and have full-featured editors (i.e., syntax highlighting, error markers, code completion, etc.)
With Spoofax/IMP, you can write the grammar of your language using the high-level
SDF grammar formalism. Based on this grammar, basic editor services such as syntax highlighting and code folding are automatically provided. Using high-level DSLs, these services can be customized and more sophisticated services such as error marking can be added. New editors can be directly loaded and used -- without starting a new Eclipse instance -- by launching the customizable Ant build file created by the new project wizard.
Features
- Rapid development of editor services essential for the modern IDE experience: code folding, outline, error marking, reference resolving, content completion, etc.
- Creates a basic, customizable editor using just the grammar.
- Editors can be changed without having to start a new Eclipse instance.
- Using SDF and SGLR, all context-free languages are supported. This means that language definitions can be composed and reused.
- Generated editors are 100% Java-based and can be deployed using the standard Eclipse update site wizard. (During editor development some native Mac/Linux/Windows binaries are used.)
Installation / Getting Started
To install Spoofax/IMP, all you need is a copy of Eclipse 3.4 or 3.5 that includes the plugin development environment (we recommend the "
Eclipse classic" distribution). Please change the eclipse.ini file to include the options
-Xss8m -Xmx512m -XX:MaxPermSize=192m -server to set a 8 MB stack size and (at least) 512 MB of virtual memory.
Spoofax/IMP can be installed using the update site mechanism of Eclipse. At this point, we've started using the editor ourselves for a number projects, but the project still has an alpha status. Still, give it a try; we welcome any feedback positive or otherwise! Using the
Help>Software Updates menu in Eclipse, Spoofax/IMP can be downloaded from the following URL:
http://www.lclnet.nl/update
In the update manager, click on the
Available Software tab. Then click
Add Site, enter the URL above, and hit OK. Add a check mark to the Spoofax/IMP update site and select the latest version. Then hit
Install, accept the license agreement, finish the installation, and finally restart Eclipse.
To get started, try creating a new Spoofax/IMP project using the
File > New > Project > Spoofax/IMP project wizard. The wizard will create a new project with an example editor that for the most part should explain and document itself. When the wizard is launched it will open editors for the crucial parts of the editor: the
SDF grammar and the (optional)
Stratego semantic rules for the language. Read these files and have a look at
.esv files in the
/editor/ directory to get an idea of the different editor services used in the definition of the editor. To rebuild it at any time use
Project > Build Project (control-alt-B) or right-click on the build.main.xml file and run it using Ant. (All
.generated.esv files are derived from the grammar, providing basic functionality, and will be overwritten when the project is rebuilt.)
Further documentation on
SDF can be found at:
http://www.syntax-definition.org/Sdf/SdfDocumentation
Further documentation on Stratego can be found at:
http://strategoxt.org/Stratego/StrategoDocumentation
Integration with Other Tools and Frameworks
Based on the Java foundation of IMP framework, any Spoofax/IMP editor can be used in conjunction with editor services defined in or interoperating with Java. One key class for tool integration is the
EditorState class, which provides things like the current or selection AST of an open editor. It also allows model listeners to be attached using
EditorState.getEditor().addModelListener(). Please
contact us if you have any questions about this or other topics.
Open Issues
We maintain a bugtracker with open issues at
http://bugs.strategoxt.org/browse/SPI, but if you run into any issues you can also directly
contact us.
Project Info
Presentation
Slides of the LDTA 2009 presentation can be found on
slideshare.
Publications
- Lennart C. L. Kats, Maartje de Jonge, Emma Nilsson-Nyman, Eelco Visser. Providing Rapid Feedback in Generated Modular Language Environments. Adding Error Recovery to Scannerless Generalized-LR Parsing. In Gary T. Leavens, editor, Proceedings of the 24th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2009), ACM, 2009. (abstract) (pdf) (bib)
- Lennart C. L. Kats, Karl T. Kalleberg, Eelco Visser. Domain-Specific Languages for Composable Editor Plugins. In Proceedings of the Ninth Workshop on Language Descriptions, Tools, and Applications (LDTA'09), Electronic Notes in Theoretical Computer Science. York, United Kingdom, March 2009. (abstract) (pdf) (bib)
Source code
The sources of the Spoofax/IMP are available from Subversion.
Development
Contributors
License
Most Spoofax/IMP code is licensed under the GNU Lesser General Public License.
Some runtime components are licensed under the Eclipse Public License;
external components may be covered by different licenses.
(It is our intention to streamline and relax this licensing scheme in the near future;
please
contact us for more information.)
Contact and Mailing List
Please send questions to the
users@strategoxt.org mailing list or
contact Lennart Kats directly. Also, the developers are usually available on IRC at
#stratego on freenode.net (
web version). Feel free to drop by!
See also