JSGLR seems to fails to apply the rejection of line 14 of the following grammar applied to the input “a”; the C sglr does it right. The problem does not occur for the reverse rejection.
Sebastian


definition
module Helper
exports

syntax %% Lexeme
-> N {cons(“AorB”)}
-> N {cons(“Any”)}

lexical syntax
“a” -> AorB
“b” -> AorB
[A-Za-z] -> Any

ReservedId -> VarId {reject}

%% VarId -> ReservedId {reject}

module Main
imports Helper

exports
start-symbols
S

syntax %% LexedDocument
N “\n” -> S {cons(“S”)}

Submitted on 8 February 2011 at 09:00
Grammar.def8 February 2011 at 09:01

On 8 February 2011 at 09:29 Lennart Kats commented:

But ReservedId is not defined in this example grammar? Also, did you test if it was the QVarId injection in your original grammar that triggered the problem? You have a similar injection (to N) here.


On 8 February 2011 at 09:34 Sebastian Erdweg commented:

right. The fixed grammar follows, the problem remains the same. Removing any indirection from the above grammar seems to remedy the ambiguity.

definition
module Helper
exports

syntax %% Lexeme
  <AorB-LEX>  -> N {cons("AorB")}
  <Any-LEX>   -> N {cons("Any")}

lexical syntax
  "a" -> AorB
  "b" -> AorB
  [A-Za-z] -> Any

  AorB -> Any {reject}

%% Any -> AorB {reject}

module Main
imports Helper

exports
start-symbols
S

syntax %% LexedDocument
  N "\n" -> S {cons("S")}

On 8 February 2011 at 09:39 Lennart Kats tagged parser

On 8 January 2013 at 15:06 Eelco Visser tagged sdf

Log in to post comments