Milestone 1 FAQ
Overview
- Installation
- Setup
- Syntax Definition
- Is it possible to split my syntax definition up in several files possibly in subfolders?
- Why do my disambiguation tests fail?
- Why does the
bracket
attribute have no effect? - Why are my
context-free priorities
not translated into SDF2? - Why does Eclipse become unresponsive when I open or run test files?
- Why do I get a StackOverflowException and how should I handle this?
- Simple Term Rewriting
Installation
How can I solve the “Unable to access language under test” error?
If you get the error “Unable to access the language under test: ‘minijava’”, then please do the following:
- Check that you are using the latest version of Spoofax Eclipse (at the moment: 2.6.0.xxxxxxxx-xxxxxx-cs4200, which can be downloaded here and not on the official Spoofax website) by going to Help > About Eclipse > Installation Details (On MacOS the About is under the left-hand menu named Eclipse). If you are using an older version, please download the newest version (again) as per the instructions.
- Make sure the path to your Spoofax installation does not contain a whitespace, single quote or any other character that might get converted when encoding the path to a URL! If this is the case, move your Spoofax installation to a location without such a character. Not doing this can cause the Build All operation in the next step to hang Eclipse.
- Clean and build all projects (through Project > Clean, Project > Build All). You can see what’s going on by opening the console (Window > Show View > Console).
- Check that the root of your project containg a “.mvn” directory. If this is not the case, you likely have to switch to a different branch which has this “.mvn” directory in it. This can be done using “git checkout
". - Finally, close and re-open any test files that were already open.
The parser succesfully parses the empty string, even though this is not defined for the given start symbol.
There is an error in the JSGLR parser that always parses an empty string (regardless of start symbol). You can ignore this.
My tests for start symbols INT and ID fail.
Check that INT and ID are defined as context-free start symbol
(even though they are part of the lexical syntax).
How can I disable the cygwin warnings about paths when building on Windows?
- Add a system environment variable
called
CYGWIN
with the valuenodosfilewarning
. - Restart eclipse.
Setup
After importing the projects into Eclipse I receive several errors that have to do with importing and including files.
If you get errors after importing the projects into Eclipse you should build the project by choosing Project > Build All from the menu.
Syntax Definition
Is it possible to split my syntax definition up in several files possibly in subfolders?
Yes, that is possible. You can have the following directory tree for example:
syntax/
subdir/
c.sdf3
b.sdf3
MyLanguage.sdf3
MyLanguage.sdf3
should have the following imports if it depends on b
and c
:
module MyLanguage
imports
b
subdir/c
and c
should be declared as
module subdir/c
Why do my disambiguation tests fail?
Disambiguation tests (i.e. tests of the form test name [[...]] parse to [[..]]
) compare the ASTs for both test fragments. If these ASTs differ, the test fails. Use the Show AST option in the editor’s Transform menu to view the AST; this may give you clue as to what is going wrong. A common mistake is to introduce a constructor when parsing a parenthesized expression. This can be solved by using the bracket
attribute.
Why does the bracket
attribute have no effect?
You probably used a constructor name together with the bracket
attribute.
As the SDF3 editor indicates, this is a mistake.
Why are my context-free priorities
not translated into SDF2?
There is an error in these priorities, which causes the generator to fail. You probably made a typo in a constructor name.
Why does Eclipse become unresponsive when I open or run test files?
There is very likely an error in your rules for LAYOUT
.
Study the rules found on the slides or in the generated Common.sdf3
in a new language project.
Fixing these issues should make running your tests way faster.
Why do I get a StackOverflowException and how should I handle this?
This is also very likely caused by erroneous rules for LAYOUT
.
- Close Eclipse.
- Delete all files in the
target
andsrc-gen
folders in your MiniJava project. - Fix the erroneous rules.
- Build your project.
Simple Term Rewriting
Why am I getting a Builder failed error when I click Show desugared syntax?
You probably do not have a snippet of code selected that can be transformed by the desugar
rule, thereby causing the editor-desugar
rule to fail.
If you select an expression and run Show desugared syntax, you will see the output of desugar
applied to that expression.
Alternatively, you could edit the editor-desugar
rule to apply the desugar-all
strategy to transform the complete AST of your MiniJava file.