JSGLR {reject} filter fails for this grammar
I have this grammar (I reduced it to 42 lines) that breaks some things in the parser.
module TestSdf exports context-free start-symbols Start context-free syntax K -> Start {cons("Start")} context-free priorities { Int -> K Id -> K } > { K -> Int K -> Id } context-free priorities { K -> Int K -> Id } > { Int -> K Id -> K } context-free syntax "r" Int -> K {cons("R")} "rw" -> K {cons("RW")} ID -> Id {cons("Id")} lexical syntax [a-zA-Z][a-zA-Z0-9]* -> ID "rw" -> ID {reject} "r" -> ID {reject} lexical restrictions ID -/- [a-zA-Z0-9] context-free priorities { } > { non-assoc: K "=>" K -> K {non-assoc, cons("Rewrite")} }Input: "rw"Result: Start(amb([RW(), Id(“rw”)]))
I would expect to have only the RW() production, but I also get the Id. Somehow the parser is tricked by the poduction “r” Int -> K and the subsorts K->Int and K->Id…
What is even more weird is that if I remove the last context-free priorities block, it works again. Something is not quite correct somewhere.
I tested this example with the old sglr written in C, and it works fine. So it is only related to JSGLR.
Tested with Spoofax 1.0.9.0-r25288, and sglr 3.16
Submitted by Radu Mereuta on 18 April 2013 at 13:59
Log in to post comments