rtg2sig will not produce constructor signatures for sorts that are not used, but SDF3 does generate pretty printer rules for unused sort. This results in an error because a constructor is referenced that is not used.

Submitted by Gabriël Konat on 21 March 2014 at 10:26

On 21 March 2014 at 10:26 Gabriël Konat tagged sdf

On 21 March 2014 at 11:04 Eelco Visser commented:

Perhaps the error is in rtg2sig, then.


On 21 March 2014 at 11:44 Gabriël Konat commented:

It’s a ‘feature’ of rtg2sig that it does not generate signatures for unreachable sorts. So either it needs to generate those signatures, or SDF3 should not generate pretty print rules for unreachable sorts.


On 10 June 2014 at 15:42 D. Pelsmaeker commented:

If an unreachable sort defines a constructor, might that constructor still be used somewhere else? If that’s the case, the signatures for unreachable sorts should still be generated.

To reproduce

  1. Create a new minimal Spoofax project MyLang.

  2. In the created syntax/MyLang.sdf3 file, add the following line:

    Test.MyConstr = <test>
    
  3. Compile.

Actual result

Now the following compilation error will appear:

stratego.jvm.helper:
    [java] [ Main | error ] in rule prettyprint-Test(0|0): constructor MyConstr/0 not declared
    [java]     MyConstr()
    [java] [ Main | error ] Compilation failed

Environment

  • Spoofax Core 1.2.0.0-s41606

On 10 June 2014 at 15:43 D. Pelsmaeker tagged !dpelsmaeker

Log in to post comments