Introduction
The semantic index is a set of stratego libraries, java primitives and editor extensions that provide a language-parametric framework for doing name binding, scoping, incremental analysis and incremental compilation.
Quick start
To be able to use the index a nightly version of Spoofax is required which can be retrieved from the following update site:
http://www.lclnet.nl/update/nightly
The simplest place to get an example on what the index can do and how a project using the index looks like is generating a new Spoofax project. Go to File->New->Project, choose "Spoofax editor project" and fill in Entity as the language name. This will generate and build a Spoofax example project for you that uses the index.
To test it out open up test/example.ent and try some things like resolving a reference, code completion and introducing errors by changing types to types that do not exist. These features are all provided by the index using naming annotations in the SDF file and Stratego code to fill in some gaps in the generic algorithm. The tutorial will go into more detail on how to define these things yourself.
More complex examples using the index are also available. We've prototyped a mini C# subset, a C subset without macros and the entity language with functions and aspects using the index. To get these examples download
this archive?, extract it somewhere, import the projects into an Eclipse workspace and build all projects (ctr+b).
Tutorial
In this tutorial we will explain how the example entity language uses the index and how to extend it with functions and simple expressions.
Analysis
Name annotations
If you look at the entity language SDF definition below you will see that it has naming annotations on certain terminals (Type@=, Type@, etc) and scope annotations on productions (scope(Type)).
"module" Module@=ID Definition* -> Start {"Module", scope(Type)}
"entity" Type@=ID "{" Property* "}" -> Definition {"Entity", scope(Property)}
Property@=ID ":" Type -> Property {"Property"}
Type@ID -> Type {"Type"}
Adjust rules
Error checking
Incremental analysis
Compilation
Inner workings
Extension points
Where can I find API documentation?
How to fix build error x?