Open agershun opened 9 years ago
The Bison docs have a section on fixing conflicts. In general, though, I believe the standard advice is, "It's really hard to write unambiguous grammars. If you can, great. If you can't, then it's usually not a problem." I am a newb to Jison, though, so take that with a grain of salt! :)
Also just a small piece of advice on simplifying your grammar: if you use the ebnf
extended syntax, you can do stuff like:
IF Expression AStatement ElseStatement?
There's an example of this in my Jison Debugger; check the "musical chords" sample in the dropdown list.
@nolanlawson - Thank you, great and useful tool! Is there way to to turn on ebnf
in Jison?
I also tryed to use this Bison documentation parts, and tried to play with %left, %right and other flags - but everything had no desired effect.
@agershun Yup, check out the Jison Debugger's "musical chords" grammar, where I enable %ebnf
. This feature is described in https://gist.github.com/zaach/1659274
Thank you, Nolan! I will create the special issue to rewrite parser with this ebnf
notation. May be I can solve this 'IF_THEN-ELSE' occasionally as well :)
@nolanlawson I love this ebnf
!!! It seems, that it does not reduce the size of the output file, but the source file is much much smaller and cleaner :+1:
Yeah ebnf is awesome. :)
Unfortunately, %ebnf
has a serious bug. See https://github.com/zaach/jison/issues/254
Thank you again for the great software! May I ask you to help to resolve one issue in the grammar file, which we can not solve.
This is a grammar file https://github.com/agershun/alasql/blob/master/src/alasqlparser.jison
When I parse my file, I receive the following warnings: Even with this warning all tests passed ok. How to modify grammar file to remove this warning?
These messages related to lines 1986-2003, which are:
Could you help me with this problem?