zaach / jison

Bison in JavaScript.
http://jison.org
4.36k stars 449 forks source link

Mysterious conflicts cannot be solved introducing a BOGUS token #56

Open josevalim opened 13 years ago

josevalim commented 13 years ago

Bison specification describes the possibility of "mysterious conflicts" in LALR parsers:

http://www.gnu.org/software/bison/manual/bison.html#Mysterious-Conflicts

However, the solution presented does not currently work in Jison. It continues showing the same reduce/reduce conflicts.

zaach commented 13 years ago

I took a look at the parser tables generated by Bison and Jison, and the difference appears to be in how Bison resolves default reductions. In their second example of resolving the conflict, switching name with ID creates a default reduction in the parser state which had the conflict, resolving the ambiguity. Jison currently only creates default reductions when one action is possible.

It's not well documented how it works (it's separate from the table generation algorithms,) so I'll have to do some digging. Thanks for catching this!

josevalim commented 13 years ago

Sweet. Just to let you know, the second example to solve the issue in that section does not work on Jison as well. I am afraid I cannot dive into Jison source code, but let me know if there is anything else I can do to help.

judofyr commented 12 years ago

Did you ever figure out how to solve this?