When multiple start symbols are specified for the syntax but no start symbol is specified for the test module, then sometimes a test might be ambiguous whereas the same code in a source code file is not ambiguous.

Here’s a simple example. This syntax, with the two start symbols:

context-free start-symbols
  
  Start Exp

context-free syntax
  
  Start = Exp
  
  Exp.Add = <<Exp> + <Exp>> {left}
  Exp.Var = <<ID>>

results in an ambiguous test when no start symbol is specified:

module Expressions

language Some-Test-Language

test Add [[
	x + y
]] parse succeeds

The test fails with this error:

Syntax is ambiguous: amb([Add(Var("x"),Var("y")),Add(Var("x"),Var("y"))])

However, a source code file with the same content:

x + y

parses without issues to:

Add(Var("x"), Var("y"))

This is an inconsistency between tests and actual source files, and actually I believe the source code file should be ambiguous too. Multiple start symbols in the syntax are common, as they are needed to make start symbol in the SPT file work.

Submitted by D. Pelsmaeker on 26 September 2014 at 12:38

On 26 September 2014 at 12:45 Guido Wachsmuth commented:

You typically specify a start symbol in the test, which should resolve the ambiguity.


On 26 September 2014 at 12:56 D. Pelsmaeker commented:

Indeed, but I’m mostly pointing out an inconsistency between code as input to a test and the same code in a source code file. I think the latter should also be ambiguous, since it uses the same set of start symbols.

Log in to post comments