When attempting to use any kind of lexical start-symbol (and no context-free start-symbols) in Spoofax/IMP I get the following error when building:

rtg2sig.helper:
    [java] [ org.strategoxt.tools.main-rtg2sig | critical ] No productive start symbols left in rtg
    [java]            RTG(Start([]),ProdRules([]))
    [java] org.strategoxt.tools.main-rtg2sig: rewriting failed

To work around this I tried to use kernel syntax like this:

syntax
  <LAYOUT?-CF> <Start-CF> <LAYOUT?-CF> -> <Start>

But this results in this error:

sdf2rtg.helper:
    [java] [ org.strategoxt.tools.main-sdf2rtg | info ] Calling external tool opt/eclipse/plugins/org.strategoxt.imp.nativebundle_0.1.1.201009201051/native/linux/sdf2table -i workspaces/spoofax/com.pany.entities/include/EntityLang.def -o /tmp/StrategoXT1404591525034008846.tmp -n -m EntityLang
    [java] [ org.strategoxt.tools.main-sdf2rtg | info ] Calling external tool opt/eclipse/plugins/org.strategoxt.imp.nativebundle_0.1.1.201009201051/native/linux/implodePT -i /tmp/StrategoXT1404591525034008846.tmp -o /tmp/StrategoXT5569488569438710603.tmp
    [java] [ org.strategoxt.tools.main-sdf2rtg | critical ] No start productions found. Did you specify any start-symbols in the syntax definition?
    [java]            []
    [java] org.strategoxt.tools.main-sdf2rtg: rewriting failed

To reproduce you can try to modify context-free start-symbols in the EntityLang (from the Spoofax tutorial) to lexical start symbols or kernel syntax:

context-free start-symbols
  Start

%%lexical start-symbols
%%  Start

%%syntax
%%  <LAYOUT?-CF> <Start-CF> <LAYOUT?-CF> -> <Start> 

I’m using Eclipse 3.6.0 and Spoofax/IMP 0.5.3.4 now.

Submitted by Tobi Vollebregt on 23 September 2010 at 16:34

On 24 September 2010 at 14:53 Lennart Kats commented:

That it wouldn’t work with lexical start symbols sort of makes sense: you cannot construct an (abstract syntax) tree using just lexical syntax, you would just get a flat string. What happens if you use kernel syntax start symbols though? i.e.


start-symbols
Start


On 24 September 2010 at 15:41 Tobi Vollebregt commented:

Hmm, from the docs I understood that the only difference between lexical start-symbols and context-free start symbols is, that the first is translated to kernel syntax like this (where the start symbol is Start):

<Start-LEX> -> <Start>

And the second (context-free) like this:

<LAYOUT?-CF> <Start-CF> <LAYOUT?-CF> -> <Start>

But as I understand from you, there are more implications?

I hoped to combine the lexical start symbol with a kernel syntax production with layout everywhere except at the beginning, but possibly I still did something wrong there.

Anyway, it is working now using:

start-symbols
  Start
syntax
  <FIRSTLINECOMMENT?-LEX> <LAYOUT?-CF> <Chunk-CF> <LAYOUT?-CF> -> Start {cons("File")}

Thanks!


On 26 September 2010 at 13:22 Lennart Kats closed this issue.

On 26 September 2010 at 13:22 Lennart Kats commented:

No problem. The thing about lexical syntax is that it is handled different when constructing the abstract syntax tree: it always yields a flat string. Context-free syntax and kernel syntax can also be used to create actual trees with child nodes.

Log in to post comments