Starting with the Spoofax Core 2.1.0-SNAPSHOT around 2016-09-20 (+/- a day), executing this Java code to load the Green-Marl frontend and backend language components:

Collection<ILanguageComponent> greenMarlComponents = new ArrayList<>();
FileObject frontendLocation = spoofax.resourceService.resolve("zip:" + frontendLocationString + "!/");
FileObject backendLocation = spoofax.resourceService.resolve("zip:" + backendLocationString + "!/");
Iterable<ILanguageDiscoveryRequest> requests = spoofax.languageDiscoveryService.request(frontendLocation);
spoofax.languageDiscoveryService.discover(requests).forEach(greenMarlComponents::add);
requests = spoofax.languageDiscoveryService.request(backendLocation);
spoofax.languageDiscoveryService.discover(requests).forEach(greenMarlComponents::add);

creates two ParseFacets. One for the frontend (which is fine and expected) and one for the backend (which is not expected, since the project’s ESV files don’t declare any parse table). With Spoofax Core 2.0.0, only a ParseFacet for the frontend is created.

Having two ParseFacets later leads to an exception when calling

spoofax.builder.build(input, new NullProgressReporter(), new CancellationToken());

Exception:

Exception in thread "main" org.metaborg.core.MetaborgRuntimeException: Multiple facets of type class org.metaborg.core.syntax.ParseFacet found, while only a single facet is supported
	at org.metaborg.core.language.LanguageImplementation.facet(LanguageImplementation.java:103)
	at org.metaborg.core.syntax.SyntaxService.parser(SyntaxService.java:49)
	at org.metaborg.core.syntax.SyntaxService.parse(SyntaxService.java:31)
	at org.metaborg.core.build.Builder.parse(Builder.java:311)
	at org.metaborg.core.build.Builder.updateLanguageResources(Builder.java:222)
	at org.metaborg.core.build.Builder.build(Builder.java:188)
...

My current workaround is to depend on Spoofax Core 2.0.0.

Submitted by Daniel Lehmann on 26 September 2016 at 18:51

On 26 September 2016 at 18:57 Guido Wachsmuth commented:

These two lines have the same RHS:

FileObject frontendLocation = spoofax.resourceService.resolve("zip:" + frontendLocationString + "!/");
FileObject backendLocation = spoofax.resourceService.resolve("zip:" + frontendLocationString + "!/");

Is this intentional?


On 26 September 2016 at 19:01 Daniel Lehmann commented:

Sorry, this was a typo when editing this issue. My failing code has different RHS. (Edited the issue here to reflect that).


On 27 September 2016 at 15:00 Eduardo Amorim commented:

Hi @dlehmann,

Please try updating Spoofax and adding to the yaml file of the backend:

  language:
    sdf:
      enabled: false

That should disable generating the SyntaxFacet, the ParseFacet, and the parse table altogether for that project.


On 27 September 2016 at 21:47 Daniel Lehmann commented:

Thanks Eduardo, with your addition to the metaborg.yaml file Spoofax Core 2.1.0-SNAPSHOT no longer adds a ParseFacet for the backend.

To better understand the issue: Was the behavior of Spoofax Core correct before (i.e. not creating a SyntaxFacet or ParseFacet) or is it now (and am I now always expected to disable SDF in the metaborg.yaml, when I don’t want the ParseFacet)?


On 29 September 2016 at 10:20 Gabriël Konat commented:

We changed the behaviour in nightly. You have to explicitly disable SDF to not get those facets.


On 29 September 2016 at 10:20 Gabriël Konat closed this issue.

Log in to post comments