Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
GNU Bison
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Counterexample generation=== One delicate issue with LR parser generators is the resolution of conflicts (shift/reduce and reduce/reduce conflicts). With many LR parser generators, resolving conflicts requires the analysis of the parser automaton, which demands some expertise from the user. To aid the user in understanding conflicts more intuitively, Bison can instead automatically generate counterexamples. For [[ambiguous grammar]]s, Bison often can even produce counterexamples that show the grammar is ambiguous. For instance, on a grammar suffering from the infamous [[dangling else]] problem, Bison reports {{Pre| doc/if-then-else.y: {{font color|purple|warning}}: shift/reduce conflict on token "else" [-{{font color|purple|Wcounterexamples}}] Example: {{font color|orange|"if" expr "then"}} {{font color|blue|"if" expr "then" stmt}} {{font color|red|β’}} {{font color|blue|"else" stmt}} Shift derivation {{font color|orange|if_stmt}} {{font color|orange|β³ "if" expr "then"}} {{font color|green|stmt}} {{font color|green|β³}} {{font color|blue|if_stmt}} {{font color|blue|β³ "if" expr "then" stmt}} {{font color|red|β’}} {{font color|blue|"else" stmt}} Example: {{font color|orange|"if" expr "then"}} {{font color|blue|"if" expr "then" stmt}} {{font color|red|β’}} {{font color|orange|"else" stmt}} Reduce derivation {{font color|orange|if_stmt}} {{font color|orange|β³ "if" expr "then"}} {{font color|green|stmt}} {{font color|orange|"else" stmt}} {{font color|green|β³}} {{font color|blue|if_stmt}} {{font color|blue|β³ "if" expr "then" stmt}} {{font color|red|β’}} }}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)