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!
==Features== ===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|β’}} }} ===Reentrancy=== Reentrancy is a feature which has been added to Bison and does not exist in Yacc. Normally, Bison generates a parser which is not [[Reentrant (subroutine)|reentrant]]. In order to achieve reentrancy the declaration <code>%define api.pure</code> must be used. More details on Bison reentrancy can be found in the Bison manual.<ref>[https://www.gnu.org/software/bison/manual/bison.html#Pure-Decl Bison Manual: A Pure (Reentrant) Parser]</ref> ===Output languages=== Bison can generate code for [[C (programming language)|C]], [[C++]], [[D (programming language)|D]] and [[Java (programming language)|Java]].<ref>[https://www.gnu.org/software/bison/manual/html_node/Decl-Summary.html Bison Manual: Bison Declaration Summary]</ref> For using the Bison-generated parser from other languages a [[language binding]] tool such as [[SWIG]] can be used.
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)