The SDF editor should report productions that are unreachable from the start symbol.

example:

module Test

hiddens
  context-free start-symbols
    Statement

context-free syntax

"foo" -> Statements {cons("Statement")}

"bar" -> Statement {cons("Statement")}

Everything compiles without errors, also the stratego code that uses the Statement constructor, but foo will never parse.

In the lab we’ve found that this can be difficult to spot in larger grammars, symptoms are constructors not being generated, or parsing failures.

Although technically not an error, it is usually a bug, and should at least give a warning.

Submitted by Danny Groenewegen on 7 July 2010 at 16:51

On 7 July 2010 at 17:39 Lennart Kats commented:

This would be very nice to have. I think Spoofax/133 already addresses most cases of it not parsing though (not all). And maybe sdf2rtg could just be changed to generate constructors for all productions to somewhat alleviate the other constructors issue (StrategoXT/831)?


On 23 June 2011 at 18:06 Danny Groenewegen tagged pitfall

On 23 June 2011 at 18:17 Danny Groenewegen commented:

This is still an annoying pitfall, especially after not having done any SDF in a while.


On 8 January 2013 at 17:04 Gabriël Konat removed tag stratego

On 8 January 2013 at 17:04 Gabriël Konat tagged sdf

On 8 January 2013 at 17:04 Gabriël Konat tagged editor

Log in to post comments