metaborg / spoofax-pie

Spoofax implementation using PIE pipelines
Apache License 2.0
12 stars 9 forks source link

SDF3 signature generation fails when alternation is used in context-free syntax #40

Closed molenzwiebel closed 3 years ago

molenzwiebel commented 3 years ago

Summary

Using alternation in context-free syntax directly results in a failure during signature generation.

What you did

Consider a program such as:

Program.Program = (VarDef | FuncDef | ClassDef)* Stmt*

This syntax is only allowed for lexical productions, but unfortunately it is also supported for context-free and as a result passes both parsing and the new statix static analysis.

What you expected to happen

An error (Spoofax 2 behavior).

What actually happened

Messages of ./:
  ERROR: Could not check Stratego because it could not be configured
  Exception of message: mb.spoofax.lwb.compiler.stratego.StrategoConfigureExceptions$Sdf3SignatureGenerateFail: SDF3 to signature generator failed
  Caused by: mb.stratego.common.StrategoExceptions$StrategyFail: Invoking Stratego strategy 'pp-stratego-string' failed

Context

Gohla commented 3 years ago

Right, we should probably disallow Sequence, Opt, and Alt in context-free syntax, as various generators do not support that.

Gohla commented 3 years ago

Fixed in https://github.com/metaborg/sdf/commit/c06c09be6c7cd48c1162d43fccafa0bd9b5fcc11, will be released in Spoofax3 0.11.9.