NEWS 155 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599
  1. GNU Bison NEWS
  2. * Noteworthy changes in release 3.7.6 (2021-03-08) [stable]
  3. ** Bug fixes
  4. *** Reused Push Parsers
  5. When a push-parser state structure is used for multiple parses, it was
  6. possible for some state to leak from one run into the following one.
  7. *** Fix Table Generation
  8. In some very rare conditions, when there are many useless tokens, it was
  9. possible to generate incorrect parsers.
  10. * Noteworthy changes in release 3.7.5 (2021-01-24) [stable]
  11. ** Bug fixes
  12. *** Counterexample Generation
  13. In some cases counterexample generation could crash. This is fixed.
  14. *** Fix Table Generation
  15. In some very rare conditions, when there are many useless tokens, it was
  16. possible to generate incorrect parsers.
  17. *** GLR parsers now support %merge together with api.value.type=union.
  18. *** C++ parsers use noexcept in more places.
  19. *** Generated parsers avoid some warnings about signedness issues.
  20. *** C-language parsers now avoid warnings from pedantic clang.
  21. *** C-language parsers now work around quirks of HP-UX 11.23 (2003).
  22. * Noteworthy changes in release 3.7.4 (2020-11-14) [stable]
  23. ** Bug fixes
  24. *** Bug fixes in yacc.c
  25. In Yacc mode, all the tokens are defined twice: once as an enum, and then
  26. as a macro. YYEMPTY was missing its macro.
  27. *** Bug fixes in lalr1.cc
  28. The lalr1.cc skeleton used to emit internal assertions (using YY_ASSERT)
  29. even when the `parse.assert` %define variable is not enabled. It no
  30. longer does.
  31. The private internal macro YY_ASSERT now obeys the `api.prefix` %define
  32. variable.
  33. When there is a very large number of tokens, some assertions could be long
  34. enough to hit arbitrary limits in Visual C++. They have been rewritten to
  35. work around this limitation.
  36. ** Changes
  37. The YYBISON macro in generated "regular C parsers" (from the "yacc.c"
  38. skeleton) used to be defined to 1. It is now defined to the version of
  39. Bison as an integer (e.g., 30704 for version 3.7.4).
  40. * Noteworthy changes in release 3.7.3 (2020-10-13) [stable]
  41. ** Bug fixes
  42. Fix concurrent build issues.
  43. The bison executable is no longer linked uselessly against libreadline.
  44. Fix incorrect use of yytname in glr.cc.
  45. * Noteworthy changes in release 3.7.2 (2020-09-05) [stable]
  46. This release of Bison fixes all known bugs reported for Bison in MITRE's
  47. Common Vulnerabilities and Exposures (CVE) system. These vulnerabilities
  48. are only about bison-the-program itself, not the generated code.
  49. Although these bugs are typically irrelevant to how Bison is used, they
  50. are worth fixing if only to give users peace of mind.
  51. There is no known vulnerability in the generated parsers.
  52. ** Bug fixes
  53. Fix concurrent build issues (introduced in Bison 3.5).
  54. Push parsers always use YYMALLOC/YYFREE (no direct calls to malloc/free).
  55. Fix portability issues of the test suite, and of bison itself.
  56. Some unlikely crashes found by fuzzing have been fixed. This is only
  57. about bison itself, not the generated parsers.
  58. * Noteworthy changes in release 3.7.1 (2020-08-02) [stable]
  59. ** Bug fixes
  60. Crash when a token alias contains a NUL byte.
  61. Portability issues with libtextstyle.
  62. Portability issues of Bison itself with MSVC.
  63. ** Changes
  64. Improvements and fixes in the documentation.
  65. More precise location about symbol type redefinitions.
  66. * Noteworthy changes in release 3.7 (2020-07-23) [stable]
  67. ** Deprecated features
  68. The YYPRINT macro, which works only with yacc.c and only for tokens, was
  69. obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
  70. It is deprecated and its support will be removed eventually.
  71. In conformance with the recommendations of the Graphviz team, in the next
  72. version Bison the option `--graph` will generate a *.gv file by default,
  73. instead of *.dot. A transition started in Bison 3.4.
  74. ** New features
  75. *** Counterexample Generation
  76. Contributed by Vincent Imbimbo.
  77. When given `-Wcounterexamples`/`-Wcex`, bison will now output
  78. counterexamples for conflicts.
  79. **** Unifying Counterexamples
  80. Unifying counterexamples are strings which can be parsed in two ways due
  81. to the conflict. For example on a grammar that contains the usual
  82. "dangling else" ambiguity:
  83. $ bison else.y
  84. else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
  85. else.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
  86. $ bison else.y -Wcex
  87. else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
  88. else.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples]
  89. Example: "if" exp "then" "if" exp "then" exp • "else" exp
  90. Shift derivation
  91. exp
  92. ↳ "if" exp "then" exp
  93. ↳ "if" exp "then" exp • "else" exp
  94. Example: "if" exp "then" "if" exp "then" exp • "else" exp
  95. Reduce derivation
  96. exp
  97. ↳ "if" exp "then" exp "else" exp
  98. ↳ "if" exp "then" exp •
  99. When text styling is enabled, colors are used in the examples and the
  100. derivations to highlight the structure of both analyses. In this case,
  101. "if" exp "then" [ "if" exp "then" exp • ] "else" exp
  102. vs.
  103. "if" exp "then" [ "if" exp "then" exp • "else" exp ]
  104. The counterexamples are "focused", in two different ways. First, they do
  105. not clutter the output with all the derivations from the start symbol,
  106. rather they start on the "conflicted nonterminal". They go straight to the
  107. point. Second, they don't "expand" nonterminal symbols uselessly.
  108. **** Nonunifying Counterexamples
  109. In the case of the dangling else, Bison found an example that can be
  110. parsed in two ways (therefore proving that the grammar is ambiguous).
  111. When it cannot find such an example, it instead generates two examples
  112. that are the same up until the dot:
  113. $ bison foo.y
  114. foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
  115. foo.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
  116. foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
  117. 4 | a: expr
  118. | ^~~~
  119. $ bison -Wcex foo.y
  120. foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
  121. foo.y: warning: shift/reduce conflict on token ID [-Wcounterexamples]
  122. First example: expr • ID ',' ID $end
  123. Shift derivation
  124. $accept
  125. ↳ s $end
  126. ↳ a ID
  127. ↳ expr
  128. ↳ expr • ID ','
  129. Second example: expr • ID $end
  130. Reduce derivation
  131. $accept
  132. ↳ s $end
  133. ↳ a ID
  134. ↳ expr •
  135. foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
  136. 4 | a: expr
  137. | ^~~~
  138. In these cases, the parser usually doesn't have enough lookahead to
  139. differentiate the two given examples.
  140. **** Reports
  141. Counterexamples are also included in the report when given
  142. `--report=counterexamples`/`-rcex` (or `--report=all`), with more
  143. technical details:
  144. State 7
  145. 1 exp: "if" exp "then" exp • [$end, "then", "else"]
  146. 2 | "if" exp "then" exp • "else" exp
  147. "else" shift, and go to state 8
  148. "else" [reduce using rule 1 (exp)]
  149. $default reduce using rule 1 (exp)
  150. shift/reduce conflict on token "else":
  151. 1 exp: "if" exp "then" exp •
  152. 2 exp: "if" exp "then" exp • "else" exp
  153. Example: "if" exp "then" "if" exp "then" exp • "else" exp
  154. Shift derivation
  155. exp
  156. ↳ "if" exp "then" exp
  157. ↳ "if" exp "then" exp • "else" exp
  158. Example: "if" exp "then" "if" exp "then" exp • "else" exp
  159. Reduce derivation
  160. exp
  161. ↳ "if" exp "then" exp "else" exp
  162. ↳ "if" exp "then" exp •
  163. *** File prefix mapping
  164. Contributed by Joshua Watt.
  165. Bison learned a new argument, `--file-prefix-map OLD=NEW`. Any file path
  166. in the output (specifically `#line` directives and `#ifdef` header guards)
  167. that begins with the prefix OLD will have it replaced with the prefix NEW,
  168. similar to the `-ffile-prefix-map` in GCC. This option can be used to
  169. make bison output reproducible.
  170. ** Changes
  171. *** Diagnostics
  172. When text styling is enabled and the terminal supports it, the warnings
  173. now include hyperlinks to the documentation.
  174. *** Relocatable installation
  175. When installed to be relocatable (via `configure --enable-relocatable`),
  176. bison will now also look for a relocated m4.
  177. *** C++ file names
  178. The `filename_type` %define variable was renamed `api.filename.type`.
  179. Instead of
  180. %define filename_type "symbol"
  181. write
  182. %define api.filename.type {symbol}
  183. (Or let `bison --update` do it for you).
  184. It now defaults to `const std::string` instead of `std::string`.
  185. *** Deprecated %define variable names
  186. The following variables have been renamed for consistency. Backward
  187. compatibility is ensured, but upgrading is recommended.
  188. filename_type -> api.filename.type
  189. package -> api.package
  190. *** Push parsers no longer clear their state when parsing is finished
  191. Previously push-parsers cleared their state when parsing was finished (on
  192. success and on failure). This made it impossible to check if there were
  193. parse errors, since `yynerrs` was also reset. This can be especially
  194. troublesome when used in autocompletion, since a parser with error
  195. recovery would suggest (irrelevant) expected tokens even if there were
  196. failures.
  197. Now the parser state can be examined when parsing is finished. The parser
  198. state is reset when starting a new parse.
  199. ** Documentation
  200. *** Examples
  201. The bistromathic demonstrates %param and how to quote sources in the error
  202. messages:
  203. > 123 456
  204. 1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
  205. 1 | 123 456
  206. | ^~~
  207. ** Bug fixes
  208. *** Include the generated header (yacc.c)
  209. Historically, when --defines was used, bison generated a header and pasted
  210. an exact copy of it into the generated parser implementation file. Since
  211. Bison 3.4 it is possible to specify that the header should be `#include`d,
  212. and how. For instance
  213. %define api.header.include {"parse.h"}
  214. or
  215. %define api.header.include {<parser/parse.h>}
  216. Now api.header.include defaults to `"header-basename"`, as was intended in
  217. Bison 3.4, where `header-basename` is the basename of the generated
  218. header. This is disabled when the generated header is `y.tab.h`, to
  219. comply with Automake's ylwrap.
  220. *** String aliases are faithfully propagated
  221. Bison used to interpret user strings (i.e., decoding backslash escapes)
  222. when reading them, and to escape them (i.e., issue non-printable
  223. characters as backslash escapes, taking the locale into account) when
  224. outputting them. As a consequence non-ASCII strings (say in UTF-8) ended
  225. up "ciphered" as sequences of backslash escapes. This happened not only
  226. in the generated sources (where the compiler will reinterpret them), but
  227. also in all the generated reports (text, xml, html, dot, etc.). Reports
  228. were therefore not readable when string aliases were not pure ASCII.
  229. Worse yet: the output depended on the user's locale.
  230. Now Bison faithfully treats the string aliases exactly the way the user
  231. spelled them. This fixes all the aforementioned problems. However, now,
  232. string aliases semantically equivalent but syntactically different (e.g.,
  233. "A", "\x41", "\101") are considered to be different.
  234. *** Crash when generating IELR
  235. An old, well hidden, bug in the generation of IELR parsers was fixed.
  236. * Noteworthy changes in release 3.6.4 (2020-06-15) [stable]
  237. ** Bug fixes
  238. In glr.cc some internal macros leaked in the user's code, and could damage
  239. access to the token kinds.
  240. * Noteworthy changes in release 3.6.3 (2020-06-03) [stable]
  241. ** Bug fixes
  242. Incorrect comments in the generated parsers.
  243. Warnings in push parsers (yacc.c).
  244. Incorrect display of gotos in LAC traces (lalr1.cc).
  245. * Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
  246. ** Bug fixes
  247. Some tests were fixed.
  248. When token aliases contain comment delimiters:
  249. %token FOO "/* foo */"
  250. bison used to emit "nested" comments, which is invalid C.
  251. * Noteworthy changes in release 3.6.1 (2020-05-10) [stable]
  252. ** Bug fixes
  253. Restored ANSI-C compliance in yacc.c.
  254. GNU readline portability issues.
  255. In C++, yy::parser::symbol_name is now a public member, as was intended.
  256. ** New features
  257. In C++, yy::parser::symbol_type now has a public name() member function.
  258. * Noteworthy changes in release 3.6 (2020-05-08) [stable]
  259. ** Backward incompatible changes
  260. TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
  261. The YYERROR_VERBOSE macro is no longer supported; the parsers that still
  262. depend on it will now produce Yacc-like error messages (just "syntax
  263. error"). It was superseded by the "%error-verbose" directive in Bison
  264. 1.875 (2003-01-01). Bison 2.6 (2012-07-19) clearly announced that support
  265. for YYERROR_VERBOSE would be removed. Note that since Bison 3.0
  266. (2013-07-25), "%error-verbose" is deprecated in favor of "%define
  267. parse.error verbose".
  268. ** Deprecated features
  269. The YYPRINT macro, which works only with yacc.c and only for tokens, was
  270. obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
  271. It is deprecated and its support will be removed eventually.
  272. ** New features
  273. *** Improved syntax error messages
  274. Two new values for the %define parse.error variable offer more control to
  275. the user. Available in all the skeletons (C, C++, Java).
  276. **** %define parse.error detailed
  277. The behavior of "%define parse.error detailed" is closely resembling that
  278. of "%define parse.error verbose" with a few exceptions. First, it is safe
  279. to use non-ASCII characters in token aliases (with 'verbose', the result
  280. depends on the locale with which bison was run). Second, a yysymbol_name
  281. function is exposed to the user, instead of the yytnamerr function and the
  282. yytname table. Third, token internationalization is supported (see
  283. below).
  284. **** %define parse.error custom
  285. With this directive, the user forges and emits the syntax error message
  286. herself by defining the yyreport_syntax_error function. A new type,
  287. yypcontext_t, captures the circumstances of the error, and provides the
  288. user with functions to get details, such as yypcontext_expected_tokens to
  289. get the list of expected token kinds.
  290. A possible implementation of yyreport_syntax_error is:
  291. int
  292. yyreport_syntax_error (const yypcontext_t *ctx)
  293. {
  294. int res = 0;
  295. YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
  296. fprintf (stderr, ": syntax error");
  297. // Report the tokens expected at this point.
  298. {
  299. enum { TOKENMAX = 10 };
  300. yysymbol_kind_t expected[TOKENMAX];
  301. int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX);
  302. if (n < 0)
  303. // Forward errors to yyparse.
  304. res = n;
  305. else
  306. for (int i = 0; i < n; ++i)
  307. fprintf (stderr, "%s %s",
  308. i == 0 ? ": expected" : " or", yysymbol_name (expected[i]));
  309. }
  310. // Report the unexpected token.
  311. {
  312. yysymbol_kind_t lookahead = yypcontext_token (ctx);
  313. if (lookahead != YYSYMBOL_YYEMPTY)
  314. fprintf (stderr, " before %s", yysymbol_name (lookahead));
  315. }
  316. fprintf (stderr, "\n");
  317. return res;
  318. }
  319. **** Token aliases internationalization
  320. When the %define variable parse.error is set to `custom` or `detailed`,
  321. one may specify which token aliases are to be translated using _(). For
  322. instance
  323. %token
  324. PLUS "+"
  325. MINUS "-"
  326. <double>
  327. NUM _("number")
  328. <symrec*>
  329. FUN _("function")
  330. VAR _("variable")
  331. In that case the user must define _() and N_(), and yysymbol_name returns
  332. the translated symbol (i.e., it returns '_("variable")' rather that
  333. '"variable"'). In Java, the user must provide an i18n() function.
  334. *** List of expected tokens (yacc.c)
  335. Push parsers may invoke yypstate_expected_tokens at any point during
  336. parsing (including even before submitting the first token) to get the list
  337. of possible tokens. This feature can be used to propose autocompletion
  338. (see below the "bistromathic" example).
  339. It makes little sense to use this feature without enabling LAC (lookahead
  340. correction).
  341. *** Returning the error token
  342. When the scanner returns an invalid token or the undefined token
  343. (YYUNDEF), the parser generates an error message and enters error
  344. recovery. Because of that error message, most scanners that find lexical
  345. errors generate an error message, and then ignore the invalid input
  346. without entering the error-recovery.
  347. The scanners may now return YYerror, the error token, to enter the
  348. error-recovery mode without triggering an additional error message. See
  349. the bistromathic for an example.
  350. *** Deep overhaul of the symbol and token kinds
  351. To avoid the confusion with types in programming languages, we now refer
  352. to token and symbol "kinds" instead of token and symbol "types". The
  353. documentation and error messages have been revised.
  354. All the skeletons have been updated to use dedicated enum types rather
  355. than integral types. Special symbols are now regular citizens, instead of
  356. being declared in ad hoc ways.
  357. **** Token kinds
  358. The "token kind" is what is returned by the scanner, e.g., PLUS, NUMBER,
  359. LPAREN, etc. While backward compatibility is of course ensured, users are
  360. nonetheless invited to replace their uses of "enum yytokentype" by
  361. "yytoken_kind_t".
  362. This type now also includes tokens that were previously hidden: YYEOF (end
  363. of input), YYUNDEF (undefined token), and YYerror (error token). They
  364. now have string aliases, internationalized when internationalization is
  365. enabled. Therefore, by default, error messages now refer to "end of file"
  366. (internationalized) rather than the cryptic "$end", or to "invalid token"
  367. rather than "$undefined".
  368. Therefore in most cases it is now useless to define the end-of-line token
  369. as follows:
  370. %token T_EOF 0 "end of file"
  371. Rather simply use "YYEOF" in your scanner.
  372. **** Symbol kinds
  373. The "symbol kinds" is what the parser actually uses. (Unless the
  374. api.token.raw %define variable is used, the symbol kind of a terminal
  375. differs from the corresponding token kind.)
  376. They are now exposed as a enum, "yysymbol_kind_t".
  377. This allows users to tailor the error messages the way they want, or to
  378. process some symbols in a specific way in autocompletion (see the
  379. bistromathic example below).
  380. *** Modernize display of explanatory statements in diagnostics
  381. Since Bison 2.7, output was indented four spaces for explanatory
  382. statements. For example:
  383. input.y:2.7-13: error: %type redeclaration for exp
  384. input.y:1.7-11: previous declaration
  385. Since the introduction of caret-diagnostics, it became less clear. This
  386. indentation has been removed and submessages are displayed similarly as in
  387. GCC:
  388. input.y:2.7-13: error: %type redeclaration for exp
  389. 2 | %type <float> exp
  390. | ^~~~~~~
  391. input.y:1.7-11: note: previous declaration
  392. 1 | %type <int> exp
  393. | ^~~~~
  394. Contributed by Victor Morales Cayuela.
  395. *** C++
  396. The token and symbol kinds are yy::parser::token_kind_type and
  397. yy::parser::symbol_kind_type.
  398. The symbol_type::kind() member function allows to get the kind of a
  399. symbol. This can be used to write unit tests for scanners, e.g.,
  400. yy::parser::symbol_type t = make_NUMBER ("123");
  401. assert (t.kind () == yy::parser::symbol_kind::S_NUMBER);
  402. assert (t.value.as<int> () == 123);
  403. ** Documentation
  404. *** User Manual
  405. In order to avoid ambiguities with "type" as in "typing", we now refer to
  406. the "token kind" (e.g., `PLUS`, `NUMBER`, etc.) rather than the "token
  407. type". We now also refer to the "symbol type" (e.g., `PLUS`, `expr`,
  408. etc.).
  409. *** Examples
  410. There are now examples/java: a very simple calculator, and a more complete
  411. one (push-parser, location tracking, and debug traces).
  412. The lexcalc example (a simple example in C based on Flex and Bison) now
  413. also demonstrates location tracking.
  414. A new C example, bistromathic, is a fully featured interactive calculator
  415. using many Bison features: pure interface, push parser, autocompletion
  416. based on the current parser state (using yypstate_expected_tokens),
  417. location tracking, internationalized custom error messages, lookahead
  418. correction, rich debug traces, etc.
  419. It shows how to depend on the symbol kinds to tailor autocompletion. For
  420. instance it recognizes the symbol kind "VARIABLE" to propose
  421. autocompletion on the existing variables, rather than of the word
  422. "variable".
  423. * Noteworthy changes in release 3.5.4 (2020-04-05) [stable]
  424. ** WARNING: Future backward-incompatibilities!
  425. TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
  426. Bison 3.6 will no longer support the YYERROR_VERBOSE macro; the parsers
  427. that still depend on it will produce Yacc-like error messages (just
  428. "syntax error"). It was superseded by the "%error-verbose" directive in
  429. Bison 1.875 (2003-01-01). Bison 2.6 (2012-07-19) clearly announced that
  430. support for YYERROR_VERBOSE would be removed. Note that since Bison 3.0
  431. (2013-07-25), "%error-verbose" is deprecated in favor of "%define
  432. parse.error verbose".
  433. ** Bug fixes
  434. Fix portability issues of the package itself on old compilers.
  435. Fix api.token.raw support in Java.
  436. * Noteworthy changes in release 3.5.3 (2020-03-08) [stable]
  437. ** Bug fixes
  438. Error messages could quote lines containing zero-width characters (such as
  439. \005) with incorrect styling. Fixes for similar issues with unexpectedly
  440. short lines (e.g., the file was changed between parsing and diagnosing).
  441. Some unlikely crashes found by fuzzing have been fixed. This is only
  442. about bison itself, not the generated parsers.
  443. * Noteworthy changes in release 3.5.2 (2020-02-13) [stable]
  444. ** Bug fixes
  445. Portability issues and minor cosmetic issues.
  446. The lalr1.cc skeleton properly rejects unsupported values for parse.lac
  447. (as yacc.c does).
  448. * Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
  449. ** Bug fixes
  450. Portability fixes.
  451. Fix compiler warnings.
  452. * Noteworthy changes in release 3.5 (2019-12-11) [stable]
  453. ** Backward incompatible changes
  454. Lone carriage-return characters (aka \r or ^M) in the grammar files are no
  455. longer treated as end-of-lines. This changes the diagnostics, and in
  456. particular their locations.
  457. In C++, line numbers and columns are now represented as 'int' not
  458. 'unsigned', so that integer overflow on positions is easily checkable via
  459. 'gcc -fsanitize=undefined' and the like. This affects the API for
  460. positions. The default position and location classes now expose
  461. 'counter_type' (int), used to define line and column numbers.
  462. ** Deprecated features
  463. The YYPRINT macro, which works only with yacc.c and only for tokens, was
  464. obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
  465. It is deprecated and its support will be removed eventually.
  466. ** New features
  467. *** Lookahead correction in C++
  468. Contributed by Adrian Vogelsgesang.
  469. The C++ deterministic skeleton (lalr1.cc) now supports LAC, via the
  470. %define variable parse.lac.
  471. *** Variable api.token.raw: Optimized token numbers (all skeletons)
  472. In the generated parsers, tokens have two numbers: the "external" token
  473. number as returned by yylex (which starts at 257), and the "internal"
  474. symbol number (which starts at 3). Each time yylex is called, a table
  475. lookup maps the external token number to the internal symbol number.
  476. When the %define variable api.token.raw is set, tokens are assigned their
  477. internal number, which saves one table lookup per token, and also saves
  478. the generation of the mapping table.
  479. The gain is typically moderate, but in extreme cases (very simple user
  480. actions), a 10% improvement can be observed.
  481. *** Generated parsers use better types for states
  482. Stacks now use the best integral type for state numbers, instead of always
  483. using 15 bits. As a result "small" parsers now have a smaller memory
  484. footprint (they use 8 bits), and there is support for large automata (16
  485. bits), and extra large (using int, i.e., typically 31 bits).
  486. *** Generated parsers prefer signed integer types
  487. Bison skeletons now prefer signed to unsigned integer types when either
  488. will do, as the signed types are less error-prone and allow for better
  489. checking with 'gcc -fsanitize=undefined'. Also, the types chosen are now
  490. portable to unusual machines where char, short and int are all the same
  491. width. On non-GNU platforms this may entail including <limits.h> and (if
  492. available) <stdint.h> to define integer types and constants.
  493. *** A skeleton for the D programming language
  494. For the last few releases, Bison has shipped a stealth experimental
  495. skeleton: lalr1.d. It was first contributed by Oliver Mangold, based on
  496. Paolo Bonzini's lalr1.java, and was cleaned and improved thanks to
  497. H. S. Teoh.
  498. However, because nobody has committed to improving, testing, and
  499. documenting this skeleton, it is not clear that it will be supported in
  500. the future.
  501. The lalr1.d skeleton *is functional*, and works well, as demonstrated in
  502. examples/d/calc.d. Please try it, enjoy it, and... commit to support it.
  503. *** Debug traces in Java
  504. The Java backend no longer emits code and data for parser tracing if the
  505. %define variable parse.trace is not defined.
  506. ** Diagnostics
  507. *** New diagnostic: -Wdangling-alias
  508. String literals, which allow for better error messages, are (too)
  509. liberally accepted by Bison, which might result in silent errors. For
  510. instance
  511. %type <exVal> cond "condition"
  512. does not define "condition" as a string alias to 'cond' (nonterminal
  513. symbols do not have string aliases). It is rather equivalent to
  514. %nterm <exVal> cond
  515. %token <exVal> "condition"
  516. i.e., it gives the type 'exVal' to the "condition" token, which was
  517. clearly not the intention.
  518. Also, because string aliases need not be defined, typos such as "baz"
  519. instead of "bar" will be not reported.
  520. The option -Wdangling-alias catches these situations. On
  521. %token BAR "bar"
  522. %type <ival> foo "foo"
  523. %%
  524. foo: "baz" {}
  525. bison -Wdangling-alias reports
  526. warning: string literal not attached to a symbol
  527. | %type <ival> foo "foo"
  528. | ^~~~~
  529. warning: string literal not attached to a symbol
  530. | foo: "baz" {}
  531. | ^~~~~
  532. The -Wall option does not (yet?) include -Wdangling-alias.
  533. *** Better POSIX Yacc compatibility diagnostics
  534. POSIX Yacc restricts %type to nonterminals. This is now diagnosed by
  535. -Wyacc.
  536. %token TOKEN1
  537. %type <ival> TOKEN1 TOKEN2 't'
  538. %token TOKEN2
  539. %%
  540. expr:
  541. gives with -Wyacc
  542. input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
  543. 2 | %type <ival> TOKEN1 TOKEN2 't'
  544. | ^~~~~~
  545. input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
  546. 2 | %type <ival> TOKEN1 TOKEN2 't'
  547. | ^~~
  548. input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
  549. 2 | %type <ival> TOKEN1 TOKEN2 't'
  550. | ^~~~~~
  551. *** Diagnostics with insertion
  552. The diagnostics now display the suggestion below the underlined source.
  553. Replacement for undeclared symbols are now also suggested.
  554. $ cat /tmp/foo.y
  555. %%
  556. list: lis '.' |
  557. $ bison -Wall foo.y
  558. foo.y:2.7-9: error: symbol 'lis' is used, but is not defined as a token and has no rules; did you mean 'list'?
  559. 2 | list: lis '.' |
  560. | ^~~
  561. | list
  562. foo.y:2.16: warning: empty rule without %empty [-Wempty-rule]
  563. 2 | list: lis '.' |
  564. | ^
  565. | %empty
  566. foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
  567. *** Diagnostics about long lines
  568. Quoted sources may now be truncated to fit the screen. For instance, on a
  569. 30-column wide terminal:
  570. $ cat foo.y
  571. %token FOO FOO FOO
  572. %%
  573. exp: FOO
  574. $ bison foo.y
  575. foo.y:1.34-36: warning: symbol FOO redeclared [-Wother]
  576. 1 | … FOO …
  577. | ^~~
  578. foo.y:1.8-10: previous declaration
  579. 1 | %token FOO …
  580. | ^~~
  581. foo.y:1.62-64: warning: symbol FOO redeclared [-Wother]
  582. 1 | … FOO
  583. | ^~~
  584. foo.y:1.8-10: previous declaration
  585. 1 | %token FOO …
  586. | ^~~
  587. ** Changes
  588. *** Debugging glr.c and glr.cc
  589. The glr.c skeleton always had asserts to check its own behavior (not the
  590. user's). These assertions are now under the control of the parse.assert
  591. %define variable (disabled by default).
  592. *** Clean up
  593. Several new compiler warnings in the generated output have been avoided.
  594. Some unused features are no longer emitted. Cleaner generated code in
  595. general.
  596. ** Bug Fixes
  597. Portability issues in the test suite.
  598. In theory, parsers using %nonassoc could crash when reporting verbose
  599. error messages. This unlikely bug has been fixed.
  600. In Java, %define api.prefix was ignored. It now behaves as expected.
  601. * Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
  602. ** Bug fixes
  603. In some cases, when warnings are disabled, bison could emit tons of white
  604. spaces as diagnostics.
  605. When running out of memory, bison could crash (found by fuzzing).
  606. When defining twice the EOF token, bison would crash.
  607. New warnings from recent compilers have been addressed in the generated
  608. parsers (yacc.c, glr.c, glr.cc).
  609. When lone carriage-return characters appeared in the input file,
  610. diagnostics could hang forever.
  611. * Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
  612. ** Bug fixes
  613. Portability fixes.
  614. * Noteworthy changes in release 3.4 (2019-05-19) [stable]
  615. ** Deprecated features
  616. The %pure-parser directive is deprecated in favor of '%define api.pure'
  617. since Bison 2.3b (2008-05-27), but no warning was issued; there is one
  618. now. Note that since Bison 2.7 you are strongly encouraged to use
  619. '%define api.pure full' instead of '%define api.pure'.
  620. ** New features
  621. *** Colored diagnostics
  622. As an experimental feature, diagnostics are now colored, controlled by the
  623. new options --color and --style.
  624. To use them, install the libtextstyle library before configuring Bison.
  625. It is available from
  626. https://alpha.gnu.org/gnu/gettext/
  627. for instance
  628. https://alpha.gnu.org/gnu/gettext/libtextstyle-0.8.tar.gz
  629. The option --color supports the following arguments:
  630. - always, yes: Enable colors.
  631. - never, no: Disable colors.
  632. - auto, tty (default): Enable colors if the output device is a tty.
  633. To customize the styles, create a CSS file similar to
  634. /* bison-bw.css */
  635. .warning { }
  636. .error { font-weight: 800; text-decoration: underline; }
  637. .note { }
  638. then invoke bison with --style=bison-bw.css, or set the BISON_STYLE
  639. environment variable to "bison-bw.css".
  640. *** Disabling output
  641. When given -fsyntax-only, the diagnostics are reported, but no output is
  642. generated.
  643. The name of this option is somewhat misleading as bison does more than
  644. just checking the syntax: every stage is run (including checking for
  645. conflicts for instance), except the generation of the output files.
  646. *** Include the generated header (yacc.c)
  647. Before, when --defines is used, bison generated a header, and pasted an
  648. exact copy of it into the generated parser implementation file. If the
  649. header name is not "y.tab.h", it is now #included instead of being
  650. duplicated.
  651. To use an '#include' even if the header name is "y.tab.h" (which is what
  652. happens with --yacc, or when using the Autotools' ylwrap), define
  653. api.header.include to the exact argument to pass to #include. For
  654. instance:
  655. %define api.header.include {"parse.h"}
  656. or
  657. %define api.header.include {<parser/parse.h>}
  658. *** api.location.type is now supported in C (yacc.c, glr.c)
  659. The %define variable api.location.type defines the name of the type to use
  660. for locations. When defined, Bison no longer defines YYLTYPE.
  661. This can be used in programs with several parsers to factor their
  662. definition of locations: let one of them generate them, and the others
  663. just use them.
  664. ** Changes
  665. *** Graphviz output
  666. In conformance with the recommendations of the Graphviz team, if %require
  667. "3.4" (or better) is specified, the option --graph generates a *.gv file
  668. by default, instead of *.dot.
  669. *** Diagnostics overhaul
  670. Column numbers were wrong with multibyte characters, which would also
  671. result in skewed diagnostics with carets. Beside, because we were
  672. indenting the quoted source with a single space, lines with tab characters
  673. were incorrectly underlined.
  674. To address these issues, and to be clearer, Bison now issues diagnostics
  675. as GCC9 does. For instance it used to display (there's a tab before the
  676. opening brace):
  677. foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
  678. expr: expr '+' "number" { $$ = $1 + $2; }
  679. ^~
  680. It now reports
  681. foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
  682. 3 | expr: expr '+' "number" { $$ = $1 + $2; }
  683. | ^~
  684. Other constructs now also have better locations, resulting in more precise
  685. diagnostics.
  686. *** Fix-it hints for %empty
  687. Running Bison with -Wempty-rules and --update will remove incorrect %empty
  688. annotations, and add the missing ones.
  689. *** Generated reports
  690. The format of the reports (parse.output) was improved for readability.
  691. *** Better support for --no-line.
  692. When --no-line is used, the generated files are now cleaner: no lines are
  693. generated instead of empty lines. Together with using api.header.include,
  694. that should help people saving the generated files into version control
  695. systems get smaller diffs.
  696. ** Documentation
  697. A new example in C shows an simple infix calculator with a hand-written
  698. scanner (examples/c/calc).
  699. A new example in C shows a reentrant parser (capable of recursive calls)
  700. built with Flex and Bison (examples/c/reccalc).
  701. There is a new section about the history of Yaccs and Bison.
  702. ** Bug fixes
  703. A few obscure bugs were fixed, including the second oldest (known) bug in
  704. Bison: it was there when Bison was entered in the RCS version control
  705. system, in December 1987. See the NEWS of Bison 3.3 for the previous
  706. oldest bug.
  707. * Noteworthy changes in release 3.3.2 (2019-02-03) [stable]
  708. ** Bug fixes
  709. Bison 3.3 failed to generate parsers for grammars with unused nonterminal
  710. symbols.
  711. * Noteworthy changes in release 3.3.1 (2019-01-27) [stable]
  712. ** Changes
  713. The option -y/--yacc used to imply -Werror=yacc, which turns uses of Bison
  714. extensions into errors. It now makes them simple warnings (-Wyacc).
  715. * Noteworthy changes in release 3.3 (2019-01-26) [stable]
  716. A new mailing list was created, Bison Announce. It is low traffic, and is
  717. only about announcing new releases and important messages (e.g., polls
  718. about major decisions to make).
  719. https://lists.gnu.org/mailman/listinfo/bison-announce
  720. ** Backward incompatible changes
  721. Support for DJGPP, which has been unmaintained and untested for years, is
  722. removed.
  723. ** Deprecated features
  724. A new feature, --update (see below) helps adjusting existing grammars to
  725. deprecations.
  726. *** Deprecated directives
  727. The %error-verbose directive is deprecated in favor of '%define
  728. parse.error verbose' since Bison 3.0, but no warning was issued.
  729. The '%name-prefix "xx"' directive is deprecated in favor of '%define
  730. api.prefix {xx}' since Bison 3.0, but no warning was issued. These
  731. directives are slightly different, you might need to adjust your code.
  732. %name-prefix renames only symbols with external linkage, while api.prefix
  733. also renames types and macros, including YYDEBUG, YYTOKENTYPE,
  734. yytokentype, YYSTYPE, YYLTYPE, etc.
  735. Users of Flex that move from '%name-prefix "xx"' to '%define api.prefix
  736. {xx}' will typically have to update YY_DECL from
  737. #define YY_DECL int xxlex (YYSTYPE *yylval, YYLTYPE *yylloc)
  738. to
  739. #define YY_DECL int xxlex (XXSTYPE *yylval, XXLTYPE *yylloc)
  740. *** Deprecated %define variable names
  741. The following variables, mostly related to parsers in Java, have been
  742. renamed for consistency. Backward compatibility is ensured, but upgrading
  743. is recommended.
  744. abstract -> api.parser.abstract
  745. annotations -> api.parser.annotations
  746. extends -> api.parser.extends
  747. final -> api.parser.final
  748. implements -> api.parser.implements
  749. parser_class_name -> api.parser.class
  750. public -> api.parser.public
  751. strictfp -> api.parser.strictfp
  752. ** New features
  753. *** Generation of fix-its for IDEs/Editors
  754. When given the new option -ffixit (aka -fdiagnostics-parseable-fixits),
  755. bison now generates machine readable editing instructions to fix some
  756. issues. Currently, this is mostly limited to updating deprecated
  757. directives and removing duplicates. For instance:
  758. $ cat foo.y
  759. %error-verbose
  760. %define parser_class_name "Parser"
  761. %define api.parser.class "Parser"
  762. %%
  763. exp:;
  764. See the "fix-it:" lines below:
  765. $ bison -ffixit foo.y
  766. foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
  767. %error-verbose
  768. ^~~~~~~~~~~~~~
  769. fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose"
  770. foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class {Parser}' [-Wdeprecated]
  771. %define parser_class_name "Parser"
  772. ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  773. fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}"
  774. foo.y:3.1-33: error: %define variable 'api.parser.class' redefined
  775. %define api.parser.class "Parser"
  776. ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  777. foo.y:2.1-34: previous definition
  778. %define parser_class_name "Parser"
  779. ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  780. fix-it:"foo.y":{3:1-3:34}:""
  781. foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
  782. This uses the same output format as GCC and Clang.
  783. *** Updating grammar files
  784. Fixes can be applied on the fly. The previous example ends with the
  785. suggestion to re-run bison with the option -u/--update, which results in a
  786. cleaner grammar file.
  787. $ bison --update foo.y
  788. [...]
  789. bison: file 'foo.y' was updated (backup: 'foo.y~')
  790. $ cat foo.y
  791. %define parse.error verbose
  792. %define api.parser.class {Parser}
  793. %%
  794. exp:;
  795. *** Bison is now relocatable
  796. If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
  797. A relocatable program can be moved or copied to a different location on
  798. the file system. It can also be used through mount points for network
  799. sharing. It is possible to make symbolic links to the installed and moved
  800. programs, and invoke them through the symbolic link.
  801. *** %expect and %expect-rr modifiers on individual rules
  802. One can now document (and check) which rules participate in shift/reduce
  803. and reduce/reduce conflicts. This is particularly important GLR parsers,
  804. where conflicts are a normal occurrence. For example,
  805. %glr-parser
  806. %expect 1
  807. %%
  808. ...
  809. argument_list:
  810. arguments %expect 1
  811. | arguments ','
  812. | %empty
  813. ;
  814. arguments:
  815. expression
  816. | argument_list ',' expression
  817. ;
  818. ...
  819. Looking at the output from -v, one can see that the shift/reduce conflict
  820. here is due to the fact that the parser does not know whether to reduce
  821. arguments to argument_list until it sees the token _after_ the following
  822. ','. By marking the rule with %expect 1 (because there is a conflict in
  823. one state), we document the source of the 1 overall shift/reduce conflict.
  824. In GLR parsers, we can use %expect-rr in a rule for reduce/reduce
  825. conflicts. In this case, we mark each of the conflicting rules. For
  826. example,
  827. %glr-parser
  828. %expect-rr 1
  829. %%
  830. stmt:
  831. target_list '=' expr ';'
  832. | expr_list ';'
  833. ;
  834. target_list:
  835. target
  836. | target ',' target_list
  837. ;
  838. target:
  839. ID %expect-rr 1
  840. ;
  841. expr_list:
  842. expr
  843. | expr ',' expr_list
  844. ;
  845. expr:
  846. ID %expect-rr 1
  847. | ...
  848. ;
  849. In a statement such as
  850. x, y = 3, 4;
  851. the parser must reduce x to a target or an expr, but does not know which
  852. until it sees the '='. So we notate the two possible reductions to
  853. indicate that each conflicts in one rule.
  854. This feature needs user feedback, and might evolve in the future.
  855. *** C++: Actual token constructors
  856. When variants and token constructors are enabled, in addition to the
  857. type-safe named token constructors (make_ID, make_INT, etc.), we now
  858. generate genuine constructors for symbol_type.
  859. For instance with these declarations
  860. %token ':'
  861. <std::string> ID
  862. <int> INT;
  863. you may use these constructors:
  864. symbol_type (int token, const std::string&);
  865. symbol_type (int token, const int&);
  866. symbol_type (int token);
  867. Correct matching between token types and value types is checked via
  868. 'assert'; for instance, 'symbol_type (ID, 42)' would abort. Named
  869. constructors are preferable, as they offer better type safety (for
  870. instance 'make_ID (42)' would not even compile), but symbol_type
  871. constructors may help when token types are discovered at run-time, e.g.,
  872. [a-z]+ {
  873. if (auto i = lookup_keyword (yytext))
  874. return yy::parser::symbol_type (i);
  875. else
  876. return yy::parser::make_ID (yytext);
  877. }
  878. *** C++: Variadic emplace
  879. If your application requires C++11 and you don't use symbol constructors,
  880. you may now use a variadic emplace for semantic values:
  881. %define api.value.type variant
  882. %token <std::pair<int, int>> PAIR
  883. in your scanner:
  884. int yylex (parser::semantic_type *lvalp)
  885. {
  886. lvalp->emplace <std::pair<int, int>> (1, 2);
  887. return parser::token::PAIR;
  888. }
  889. *** C++: Syntax error exceptions in GLR
  890. The glr.cc skeleton now supports syntax_error exceptions thrown from user
  891. actions, or from the scanner.
  892. *** More POSIX Yacc compatibility warnings
  893. More Bison specific directives are now reported with -y or -Wyacc. This
  894. change was ready since the release of Bison 3.0 in September 2015. It was
  895. delayed because Autoconf used to define YACC as `bison -y`, which resulted
  896. in numerous warnings for Bison users that use the GNU Build System.
  897. If you still experience that problem, either redefine YACC as `bison -o
  898. y.tab.c`, or pass -Wno-yacc to Bison.
  899. *** The tables yyrhs and yyphrs are back
  900. Because no Bison skeleton uses them, these tables were removed (no longer
  901. passed to the skeletons, not even computed) in 2008. However, some users
  902. have expressed interest in being able to use them in their own skeletons.
  903. ** Bug fixes
  904. *** Incorrect number of reduce/reduce conflicts
  905. On a grammar such as
  906. exp: "num" | "num" | "num"
  907. bison used to report a single RR conflict, instead of two. This is now
  908. fixed. This was the oldest (known) bug in Bison: it was there when Bison
  909. was entered in the RCS version control system, in December 1987.
  910. Some grammar files might have to adjust their %expect-rr.
  911. *** Parser directives that were not careful enough
  912. Passing invalid arguments to %nterm, for instance character literals, used
  913. to result in unclear error messages.
  914. ** Documentation
  915. The examples/ directory (installed in .../share/doc/bison/examples) has
  916. been restructured per language for clarity. The examples come with a
  917. README and a Makefile. Not only can they be used to toy with Bison, they
  918. can also be starting points for your own grammars.
  919. There is now a Java example, and a simple example in C based on Flex and
  920. Bison (examples/c/lexcalc/).
  921. ** Changes
  922. *** Parsers in C++
  923. They now use noexcept and constexpr. Please, report missing annotations.
  924. *** Symbol Declarations
  925. The syntax of the variation directives to declare symbols was overhauled
  926. for more consistency, and also better POSIX Yacc compliance (which, for
  927. instance, allows "%type" without actually providing a type). The %nterm
  928. directive, supported by Bison since its inception, is now documented and
  929. officially supported.
  930. The syntax is now as follows:
  931. %token TAG? ( ID NUMBER? STRING? )+ ( TAG ( ID NUMBER? STRING? )+ )*
  932. %left TAG? ( ID NUMBER? )+ ( TAG ( ID NUMBER? )+ )*
  933. %type TAG? ( ID | CHAR | STRING )+ ( TAG ( ID | CHAR | STRING )+ )*
  934. %nterm TAG? ID+ ( TAG ID+ )*
  935. where TAG denotes a type tag such as ‘<ival>’, ID denotes an identifier
  936. such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or
  937. ‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string
  938. literal such as ‘"number"’. The post-fix quantifiers are ‘?’ (zero or
  939. one), ‘*’ (zero or more) and ‘+’ (one or more).
  940. * Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
  941. ** Bug fixes
  942. Fix the move constructor of symbol_type.
  943. Always provide a copy constructor for symbol_type, even in modern C++.
  944. * Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
  945. ** Bug fixes
  946. Properly support token constructors in C++ with types that include commas
  947. (e.g., std::pair<int, int>). A regression introduced in Bison 3.2.
  948. * Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
  949. ** Bug fixes
  950. C++ portability issues.
  951. * Noteworthy changes in release 3.2.1 (2018-11-09) [stable]
  952. ** Bug fixes
  953. Several portability issues have been fixed in the build system, in the
  954. test suite, and in the generated parsers in C++.
  955. * Noteworthy changes in release 3.2 (2018-10-29) [stable]
  956. ** Backward incompatible changes
  957. Support for DJGPP, which has been unmaintained and untested for years, is
  958. obsolete. Unless there is activity to revive it, it will be removed.
  959. ** Changes
  960. %printers should use yyo rather than yyoutput to denote the output stream.
  961. Variant-based symbols in C++ should use emplace() rather than build().
  962. In C++ parsers, parser::operator() is now a synonym for the parser::parse.
  963. ** Documentation
  964. A new section, "A Simple C++ Example", is a tutorial for parsers in C++.
  965. A comment in the generated code now emphasizes that users should not
  966. depend upon non-documented implementation details, such as macros starting
  967. with YY_.
  968. ** New features
  969. *** C++: Support for move semantics (lalr1.cc)
  970. The lalr1.cc skeleton now fully supports C++ move semantics, while
  971. maintaining compatibility with C++98. You may now store move-only types
  972. when using Bison's variants. For instance:
  973. %code {
  974. #include <memory>
  975. #include <vector>
  976. }
  977. %skeleton "lalr1.cc"
  978. %define api.value.type variant
  979. %%
  980. %token <int> INT "int";
  981. %type <std::unique_ptr<int>> int;
  982. %type <std::vector<std::unique_ptr<int>>> list;
  983. list:
  984. %empty {}
  985. | list int { $$ = std::move($1); $$.emplace_back(std::move($2)); }
  986. int: "int" { $$ = std::make_unique<int>($1); }
  987. *** C++: Implicit move of right-hand side values (lalr1.cc)
  988. In modern C++ (C++11 and later), you should always use 'std::move' with
  989. the values of the right-hand side symbols ($1, $2, etc.), as they will be
  990. popped from the stack anyway. Using 'std::move' is mandatory for
  991. move-only types such as unique_ptr, and it provides a significant speedup
  992. for large types such as std::string, or std::vector, etc.
  993. If '%define api.value.automove' is set, every occurrence '$n' is replaced
  994. by 'std::move ($n)'. The second rule in the previous grammar can be
  995. simplified to:
  996. list: list int { $$ = $1; $$.emplace_back($2); }
  997. With automove enabled, the semantic values are no longer lvalues, so do
  998. not use the swap idiom:
  999. list: list int { std::swap($$, $1); $$.emplace_back($2); }
  1000. This idiom is anyway obsolete: it is preferable to move than to swap.
  1001. A warning is issued when automove is enabled, and a value is used several
  1002. times.
  1003. input.yy:16.31-32: warning: multiple occurrences of $2 with api.value.automove enabled [-Wother]
  1004. exp: "twice" exp { $$ = $2 + $2; }
  1005. ^^
  1006. Enabling api.value.automove does not require support for modern C++. The
  1007. generated code is valid C++98/03, but will use copies instead of moves.
  1008. The new examples/c++/variant-11.yy shows these features in action.
  1009. *** C++: The implicit default semantic action is always run
  1010. When variants are enabled, the default action was not run, so
  1011. exp: "number"
  1012. was equivalent to
  1013. exp: "number" {}
  1014. It now behaves like in all the other cases, as
  1015. exp: "number" { $$ = $1; }
  1016. possibly using std::move if automove is enabled.
  1017. We do not expect backward compatibility issues. However, beware of
  1018. forward compatibility issues: if you rely on default actions with
  1019. variants, be sure to '%require "3.2"' to avoid older versions of Bison to
  1020. generate incorrect parsers.
  1021. *** C++: Renaming location.hh
  1022. When both %defines and %locations are enabled, Bison generates a
  1023. location.hh file. If you don't use locations outside of the parser, you
  1024. may avoid its creation with:
  1025. %define api.location.file none
  1026. However this file is useful if, for instance, your parser builds an AST
  1027. decorated with locations: you may use Bison's location independently of
  1028. Bison's parser. You can now give it another name, for instance:
  1029. %define api.location.file "my-location.hh"
  1030. This name can have directory components, and even be absolute. The name
  1031. under which the location file is included is controlled by
  1032. api.location.include.
  1033. This way it is possible to have several parsers share the same location
  1034. file.
  1035. For instance, in src/foo/parser.hh, generate the include/ast/loc.hh file:
  1036. %locations
  1037. %define api.namespace {foo}
  1038. %define api.location.file "include/ast/loc.hh"
  1039. %define api.location.include {<ast/loc.hh>}
  1040. and use it in src/bar/parser.hh:
  1041. %locations
  1042. %define api.namespace {bar}
  1043. %code requires {#include <ast/loc.hh>}
  1044. %define api.location.type {bar::location}
  1045. Absolute file names are supported, so in your Makefile, passing the flag
  1046. -Dapi.location.file='"$(top_srcdir)/include/ast/location.hh"' to bison is
  1047. safe.
  1048. *** C++: stack.hh and position.hh are deprecated
  1049. When asked to generate a header file (%defines), the lalr1.cc skeleton
  1050. generates a stack.hh file. This file had no interest for users; it is now
  1051. made useless: its content is included in the parser definition. It is
  1052. still generated for backward compatibility.
  1053. When in addition to %defines, location support is requested (%locations),
  1054. the file position.hh is also generated. It is now also useless: its
  1055. content is now included in location.hh.
  1056. These files are no longer generated when your grammar file requires at
  1057. least Bison 3.2 (%require "3.2").
  1058. ** Bug fixes
  1059. Portability issues on MinGW and VS2015.
  1060. Portability issues in the test suite.
  1061. Portability/warning issues with Flex.
  1062. * Noteworthy changes in release 3.1 (2018-08-27) [stable]
  1063. ** Backward incompatible changes
  1064. Compiling Bison now requires a C99 compiler---as announced during the
  1065. release of Bison 3.0, five years ago. Generated parsers do not require a
  1066. C99 compiler.
  1067. Support for DJGPP, which has been unmaintained and untested for years, is
  1068. obsolete. Unless there is activity to revive it, the next release of Bison
  1069. will have it removed.
  1070. ** New features
  1071. *** Typed midrule actions
  1072. Because their type is unknown to Bison, the values of midrule actions are
  1073. not treated like the others: they don't have %printer and %destructor
  1074. support. It also prevents C++ (Bison) variants to handle them properly.
  1075. Typed midrule actions address these issues. Instead of:
  1076. exp: { $<ival>$ = 1; } { $<ival>$ = 2; } { $$ = $<ival>1 + $<ival>2; }
  1077. write:
  1078. exp: <ival>{ $$ = 1; } <ival>{ $$ = 2; } { $$ = $1 + $2; }
  1079. *** Reports include the type of the symbols
  1080. The sections about terminal and nonterminal symbols of the '*.output' file
  1081. now specify their declared type. For instance, for:
  1082. %token <ival> NUM
  1083. the report now shows '<ival>':
  1084. Terminals, with rules where they appear
  1085. NUM <ival> (258) 5
  1086. *** Diagnostics about useless rules
  1087. In the following grammar, the 'exp' nonterminal is trivially useless. So,
  1088. of course, its rules are useless too.
  1089. %%
  1090. input: '0' | exp
  1091. exp: exp '+' exp | exp '-' exp | '(' exp ')'
  1092. Previously all the useless rules were reported, including those whose
  1093. left-hand side is the 'exp' nonterminal:
  1094. warning: 1 nonterminal useless in grammar [-Wother]
  1095. warning: 4 rules useless in grammar [-Wother]
  1096. 2.14-16: warning: nonterminal useless in grammar: exp [-Wother]
  1097. input: '0' | exp
  1098. ^^^
  1099. 2.14-16: warning: rule useless in grammar [-Wother]
  1100. input: '0' | exp
  1101. ^^^
  1102. 3.6-16: warning: rule useless in grammar [-Wother]
  1103. exp: exp '+' exp | exp '-' exp | '(' exp ')'
  1104. ^^^^^^^^^^^
  1105. 3.20-30: warning: rule useless in grammar [-Wother]
  1106. exp: exp '+' exp | exp '-' exp | '(' exp ')'
  1107. ^^^^^^^^^^^
  1108. 3.34-44: warning: rule useless in grammar [-Wother]
  1109. exp: exp '+' exp | exp '-' exp | '(' exp ')'
  1110. ^^^^^^^^^^^
  1111. Now, rules whose left-hand side symbol is useless are no longer reported
  1112. as useless. The locations of the errors have also been adjusted to point
  1113. to the first use of the nonterminal as a left-hand side of a rule:
  1114. warning: 1 nonterminal useless in grammar [-Wother]
  1115. warning: 4 rules useless in grammar [-Wother]
  1116. 3.1-3: warning: nonterminal useless in grammar: exp [-Wother]
  1117. exp: exp '+' exp | exp '-' exp | '(' exp ')'
  1118. ^^^
  1119. 2.14-16: warning: rule useless in grammar [-Wother]
  1120. input: '0' | exp
  1121. ^^^
  1122. *** C++: Generated parsers can be compiled with -fno-exceptions (lalr1.cc)
  1123. When compiled with exceptions disabled, the generated parsers no longer
  1124. uses try/catch clauses.
  1125. Currently only GCC and Clang are supported.
  1126. ** Documentation
  1127. *** A demonstration of variants
  1128. A new example was added (installed in .../share/doc/bison/examples),
  1129. 'variant.yy', which shows how to use (Bison) variants in C++.
  1130. The other examples were made nicer to read.
  1131. *** Some features are no longer 'experimental'
  1132. The following features, mature enough, are no longer flagged as
  1133. experimental in the documentation: push parsers, default %printer and
  1134. %destructor (typed: <*> and untyped: <>), %define api.value.type union and
  1135. variant, Java parsers, XML output, LR family (lr, ielr, lalr), and
  1136. semantic predicates (%?).
  1137. ** Bug fixes
  1138. *** GLR: Predicates support broken by #line directives
  1139. Predicates (%?) in GLR such as
  1140. widget:
  1141. %? {new_syntax} 'w' id new_args
  1142. | %?{!new_syntax} 'w' id old_args
  1143. were issued with #lines in the middle of C code.
  1144. *** Printer and destructor with broken #line directives
  1145. The #line directives were not properly escaped when emitting the code for
  1146. %printer/%destructor, which resulted in compiler errors if there are
  1147. backslashes or double-quotes in the grammar file name.
  1148. *** Portability on ICC
  1149. The Intel compiler claims compatibility with GCC, yet rejects its _Pragma.
  1150. Generated parsers now work around this.
  1151. *** Various
  1152. There were several small fixes in the test suite and in the build system,
  1153. many warnings in bison and in the generated parsers were eliminated. The
  1154. documentation also received its share of minor improvements.
  1155. Useless code was removed from C++ parsers, and some of the generated
  1156. constructors are more 'natural'.
  1157. * Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
  1158. ** Bug fixes
  1159. *** C++: Fix support of 'syntax_error'
  1160. One incorrect 'inline' resulted in linking errors about the constructor of
  1161. the syntax_error exception.
  1162. *** C++: Fix warnings
  1163. GCC 7.3 (with -O1 or -O2 but not -O0 or -O3) issued null-dereference
  1164. warnings about yyformat being possibly null. It also warned about the
  1165. deprecated implicit definition of copy constructors when there's a
  1166. user-defined (copy) assignment operator.
  1167. *** Location of errors
  1168. In C++ parsers, out-of-bounds errors can happen when a rule with an empty
  1169. ride-hand side raises a syntax error. The behavior of the default parser
  1170. (yacc.c) in such a condition was undefined.
  1171. Now all the parsers match the behavior of glr.c: @$ is used as the
  1172. location of the error. This handles gracefully rules with and without
  1173. rhs.
  1174. *** Portability fixes in the test suite
  1175. On some platforms, some Java and/or C++ tests were failing.
  1176. * Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
  1177. ** Bug fixes
  1178. *** C++ with Variants (lalr1.cc)
  1179. Fix a compiler warning when no %destructor use $$.
  1180. *** Test suites
  1181. Several portability issues in tests were fixed.
  1182. * Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
  1183. ** Bug fixes
  1184. *** C++ with Variants (lalr1.cc)
  1185. Problems with %destructor and '%define parse.assert' have been fixed.
  1186. *** Named %union support (yacc.c, glr.c)
  1187. Bison 3.0 introduced a regression on named %union such as
  1188. %union foo { int ival; };
  1189. The possibility to use a name was introduced "for Yacc compatibility".
  1190. It is however not required by POSIX Yacc, and its usefulness is not clear.
  1191. *** %define api.value.type union with %defines (yacc.c, glr.c)
  1192. The C parsers were broken when %defines was used together with "%define
  1193. api.value.type union".
  1194. *** Redeclarations are reported in proper order
  1195. On
  1196. %token FOO "foo"
  1197. %printer {} "foo"
  1198. %printer {} FOO
  1199. bison used to report:
  1200. foo.yy:2.10-11: error: %printer redeclaration for FOO
  1201. %printer {} "foo"
  1202. ^^
  1203. foo.yy:3.10-11: previous declaration
  1204. %printer {} FOO
  1205. ^^
  1206. Now, the "previous" declaration is always the first one.
  1207. ** Documentation
  1208. Bison now installs various files in its docdir (which defaults to
  1209. '/usr/local/share/doc/bison'), including the three fully blown examples
  1210. extracted from the documentation:
  1211. - rpcalc
  1212. Reverse Polish Calculator, a simple introductory example.
  1213. - mfcalc
  1214. Multi-function Calc, a calculator with memory and functions and located
  1215. error messages.
  1216. - calc++
  1217. a calculator in C++ using variant support and token constructors.
  1218. * Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
  1219. ** Bug fixes
  1220. *** Generated source files when errors are reported
  1221. When warnings are issued and -Werror is set, bison would still generate
  1222. the source files (*.c, *.h...). As a consequence, some runs of "make"
  1223. could fail the first time, but not the second (as the files were generated
  1224. anyway).
  1225. This is fixed: bison no longer generates this source files, but, of
  1226. course, still produces the various reports (*.output, *.xml, etc.).
  1227. *** %empty is used in reports
  1228. Empty right-hand sides are denoted by '%empty' in all the reports (text,
  1229. dot, XML and formats derived from it).
  1230. *** YYERROR and variants
  1231. When C++ variant support is enabled, an error triggered via YYERROR, but
  1232. not caught via error recovery, resulted in a double deletion.
  1233. * Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
  1234. ** Bug fixes
  1235. *** Errors in caret diagnostics
  1236. On some platforms, some errors could result in endless diagnostics.
  1237. *** Fixes of the -Werror option
  1238. Options such as "-Werror -Wno-error=foo" were still turning "foo"
  1239. diagnostics into errors instead of warnings. This is fixed.
  1240. Actually, for consistency with GCC, "-Wno-error=foo -Werror" now also
  1241. leaves "foo" diagnostics as warnings. Similarly, with "-Werror=foo
  1242. -Wno-error", "foo" diagnostics are now errors.
  1243. *** GLR Predicates
  1244. As demonstrated in the documentation, one can now leave spaces between
  1245. "%?" and its "{".
  1246. *** Installation
  1247. The yacc.1 man page is no longer installed if --disable-yacc was
  1248. specified.
  1249. *** Fixes in the test suite
  1250. Bugs and portability issues.
  1251. * Noteworthy changes in release 3.0 (2013-07-25) [stable]
  1252. ** WARNING: Future backward-incompatibilities!
  1253. Like other GNU packages, Bison will start using some of the C99 features
  1254. for its own code, especially the definition of variables after statements.
  1255. The generated C parsers still aim at C90.
  1256. ** Backward incompatible changes
  1257. *** Obsolete features
  1258. Support for YYFAIL is removed (deprecated in Bison 2.4.2): use YYERROR.
  1259. Support for yystype and yyltype is removed (deprecated in Bison 1.875):
  1260. use YYSTYPE and YYLTYPE.
  1261. Support for YYLEX_PARAM and YYPARSE_PARAM is removed (deprecated in Bison
  1262. 1.875): use %lex-param, %parse-param, or %param.
  1263. Missing semicolons at the end of actions are no longer added (as announced
  1264. in the release 2.5).
  1265. *** Use of YACC='bison -y'
  1266. TL;DR: With Autoconf <= 2.69, pass -Wno-yacc to (AM_)YFLAGS if you use
  1267. Bison extensions.
  1268. Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
  1269. Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
  1270. 'y.tab.h' and 'y.output') to be generated from 'foo.y'.
  1271. To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
  1272. implementation of Yacc, was using Bison as 'bison -y'. While it does
  1273. ensure compatible output file names, it also enables warnings for
  1274. incompatibilities with POSIX Yacc. In other words, 'bison -y' triggers
  1275. warnings for Bison extensions.
  1276. Autoconf 2.70+ fixes this incompatibility by using YACC='bison -o y.tab.c'
  1277. (which also generates 'y.tab.h' and 'y.output' when needed).
  1278. Alternatively, disable Yacc warnings by passing '-Wno-yacc' to your Yacc
  1279. flags (YFLAGS, or AM_YFLAGS with Automake).
  1280. ** Bug fixes
  1281. *** The epilogue is no longer affected by internal #defines (glr.c)
  1282. The glr.c skeleton uses defines such as #define yylval (yystackp->yyval) in
  1283. generated code. These weren't properly undefined before the inclusion of
  1284. the user epilogue, so functions such as the following were butchered by the
  1285. preprocessor expansion:
  1286. int yylex (YYSTYPE *yylval);
  1287. This is fixed: yylval, yynerrs, yychar, and yylloc are now valid
  1288. identifiers for user-provided variables.
  1289. *** stdio.h is no longer needed when locations are enabled (yacc.c)
  1290. Changes in Bison 2.7 introduced a dependency on FILE and fprintf when
  1291. locations are enabled. This is fixed.
  1292. *** Warnings about useless %pure-parser/%define api.pure are restored
  1293. ** Diagnostics reported by Bison
  1294. Most of these features were contributed by Théophile Ranquet and Victor
  1295. Santet.
  1296. *** Carets
  1297. Version 2.7 introduced caret errors, for a prettier output. These are now
  1298. activated by default. The old format can still be used by invoking Bison
  1299. with -fno-caret (or -fnone).
  1300. Some error messages that reproduced excerpts of the grammar are now using
  1301. the caret information only. For instance on:
  1302. %%
  1303. exp: 'a' | 'a';
  1304. Bison 2.7 reports:
  1305. in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
  1306. in.y:2.12-14: warning: rule useless in parser due to conflicts: exp: 'a' [-Wother]
  1307. Now bison reports:
  1308. in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
  1309. in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
  1310. exp: 'a' | 'a';
  1311. ^^^
  1312. and "bison -fno-caret" reports:
  1313. in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
  1314. in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
  1315. *** Enhancements of the -Werror option
  1316. The -Werror=CATEGORY option is now recognized, and will treat specified
  1317. warnings as errors. The warnings need not have been explicitly activated
  1318. using the -W option, this is similar to what GCC 4.7 does.
  1319. For example, given the following command line, Bison will treat both
  1320. warnings related to POSIX Yacc incompatibilities and S/R conflicts as
  1321. errors (and only those):
  1322. $ bison -Werror=yacc,error=conflicts-sr input.y
  1323. If no categories are specified, -Werror will make all active warnings into
  1324. errors. For example, the following line does the same the previous example:
  1325. $ bison -Werror -Wnone -Wyacc -Wconflicts-sr input.y
  1326. (By default -Wconflicts-sr,conflicts-rr,deprecated,other is enabled.)
  1327. Note that the categories in this -Werror option may not be prefixed with
  1328. "no-". However, -Wno-error[=CATEGORY] is valid.
  1329. Note that -y enables -Werror=yacc. Therefore it is now possible to require
  1330. Yacc-like behavior (e.g., always generate y.tab.c), but to report
  1331. incompatibilities as warnings: "-y -Wno-error=yacc".
  1332. *** The display of warnings is now richer
  1333. The option that controls a given warning is now displayed:
  1334. foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
  1335. In the case of warnings treated as errors, the prefix is changed from
  1336. "warning: " to "error: ", and the suffix is displayed, in a manner similar
  1337. to GCC, as [-Werror=CATEGORY].
  1338. For instance, where the previous version of Bison would report (and exit
  1339. with failure):
  1340. bison: warnings being treated as errors
  1341. input.y:1.1: warning: stray ',' treated as white space
  1342. it now reports:
  1343. input.y:1.1: error: stray ',' treated as white space [-Werror=other]
  1344. *** Deprecated constructs
  1345. The new 'deprecated' warning category flags obsolete constructs whose
  1346. support will be discontinued. It is enabled by default. These warnings
  1347. used to be reported as 'other' warnings.
  1348. *** Useless semantic types
  1349. Bison now warns about useless (uninhabited) semantic types. Since
  1350. semantic types are not declared to Bison (they are defined in the opaque
  1351. %union structure), it is %printer/%destructor directives about useless
  1352. types that trigger the warning:
  1353. %token <type1> term
  1354. %type <type2> nterm
  1355. %printer {} <type1> <type3>
  1356. %destructor {} <type2> <type4>
  1357. %%
  1358. nterm: term { $$ = $1; };
  1359. 3.28-34: warning: type <type3> is used, but is not associated to any symbol
  1360. 4.28-34: warning: type <type4> is used, but is not associated to any symbol
  1361. *** Undefined but unused symbols
  1362. Bison used to raise an error for undefined symbols that are not used in
  1363. the grammar. This is now only a warning.
  1364. %printer {} symbol1
  1365. %destructor {} symbol2
  1366. %type <type> symbol3
  1367. %%
  1368. exp: "a";
  1369. *** Useless destructors or printers
  1370. Bison now warns about useless destructors or printers. In the following
  1371. example, the printer for <type1>, and the destructor for <type2> are
  1372. useless: all symbols of <type1> (token1) already have a printer, and all
  1373. symbols of type <type2> (token2) already have a destructor.
  1374. %token <type1> token1
  1375. <type2> token2
  1376. <type3> token3
  1377. <type4> token4
  1378. %printer {} token1 <type1> <type3>
  1379. %destructor {} token2 <type2> <type4>
  1380. *** Conflicts
  1381. The warnings and error messages about shift/reduce and reduce/reduce
  1382. conflicts have been normalized. For instance on the following foo.y file:
  1383. %glr-parser
  1384. %%
  1385. exp: exp '+' exp | '0' | '0';
  1386. compare the previous version of bison:
  1387. $ bison foo.y
  1388. foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
  1389. $ bison -Werror foo.y
  1390. bison: warnings being treated as errors
  1391. foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
  1392. with the new behavior:
  1393. $ bison foo.y
  1394. foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
  1395. foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
  1396. $ bison -Werror foo.y
  1397. foo.y: error: 1 shift/reduce conflict [-Werror=conflicts-sr]
  1398. foo.y: error: 2 reduce/reduce conflicts [-Werror=conflicts-rr]
  1399. When %expect or %expect-rr is used, such as with bar.y:
  1400. %expect 0
  1401. %glr-parser
  1402. %%
  1403. exp: exp '+' exp | '0' | '0';
  1404. Former behavior:
  1405. $ bison bar.y
  1406. bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
  1407. bar.y: expected 0 shift/reduce conflicts
  1408. bar.y: expected 0 reduce/reduce conflicts
  1409. New one:
  1410. $ bison bar.y
  1411. bar.y: error: shift/reduce conflicts: 1 found, 0 expected
  1412. bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
  1413. ** Incompatibilities with POSIX Yacc
  1414. The 'yacc' category is no longer part of '-Wall', enable it explicitly
  1415. with '-Wyacc'.
  1416. ** Additional yylex/yyparse arguments
  1417. The new directive %param declares additional arguments to both yylex and
  1418. yyparse. The %lex-param, %parse-param, and %param directives support one
  1419. or more arguments. Instead of
  1420. %lex-param {arg1_type *arg1}
  1421. %lex-param {arg2_type *arg2}
  1422. %parse-param {arg1_type *arg1}
  1423. %parse-param {arg2_type *arg2}
  1424. one may now declare
  1425. %param {arg1_type *arg1} {arg2_type *arg2}
  1426. ** Types of values for %define variables
  1427. Bison used to make no difference between '%define foo bar' and '%define
  1428. foo "bar"'. The former is now called a 'keyword value', and the latter a
  1429. 'string value'. A third kind was added: 'code values', such as '%define
  1430. foo {bar}'.
  1431. Keyword variables are used for fixed value sets, e.g.,
  1432. %define lr.type lalr
  1433. Code variables are used for value in the target language, e.g.,
  1434. %define api.value.type {struct semantic_type}
  1435. String variables are used remaining cases, e.g. file names.
  1436. ** Variable api.token.prefix
  1437. The variable api.token.prefix changes the way tokens are identified in
  1438. the generated files. This is especially useful to avoid collisions
  1439. with identifiers in the target language. For instance
  1440. %token FILE for ERROR
  1441. %define api.token.prefix {TOK_}
  1442. %%
  1443. start: FILE for ERROR;
  1444. will generate the definition of the symbols TOK_FILE, TOK_for, and
  1445. TOK_ERROR in the generated sources. In particular, the scanner must
  1446. use these prefixed token names, although the grammar itself still
  1447. uses the short names (as in the sample rule given above).
  1448. ** Variable api.value.type
  1449. This new %define variable supersedes the #define macro YYSTYPE. The use
  1450. of YYSTYPE is discouraged. In particular, #defining YYSTYPE *and* either
  1451. using %union or %defining api.value.type results in undefined behavior.
  1452. Either define api.value.type, or use "%union":
  1453. %union
  1454. {
  1455. int ival;
  1456. char *sval;
  1457. }
  1458. %token <ival> INT "integer"
  1459. %token <sval> STRING "string"
  1460. %printer { fprintf (yyo, "%d", $$); } <ival>
  1461. %destructor { free ($$); } <sval>
  1462. /* In yylex(). */
  1463. yylval.ival = 42; return INT;
  1464. yylval.sval = "42"; return STRING;
  1465. The %define variable api.value.type supports both keyword and code values.
  1466. The keyword value 'union' means that the user provides genuine types, not
  1467. union member names such as "ival" and "sval" above (WARNING: will fail if
  1468. -y/--yacc/%yacc is enabled).
  1469. %define api.value.type union
  1470. %token <int> INT "integer"
  1471. %token <char *> STRING "string"
  1472. %printer { fprintf (yyo, "%d", $$); } <int>
  1473. %destructor { free ($$); } <char *>
  1474. /* In yylex(). */
  1475. yylval.INT = 42; return INT;
  1476. yylval.STRING = "42"; return STRING;
  1477. The keyword value variant is somewhat equivalent, but for C++ special
  1478. provision is made to allow classes to be used (more about this below).
  1479. %define api.value.type variant
  1480. %token <int> INT "integer"
  1481. %token <std::string> STRING "string"
  1482. Code values (in braces) denote user defined types. This is where YYSTYPE
  1483. used to be used.
  1484. %code requires
  1485. {
  1486. struct my_value
  1487. {
  1488. enum
  1489. {
  1490. is_int, is_string
  1491. } kind;
  1492. union
  1493. {
  1494. int ival;
  1495. char *sval;
  1496. } u;
  1497. };
  1498. }
  1499. %define api.value.type {struct my_value}
  1500. %token <u.ival> INT "integer"
  1501. %token <u.sval> STRING "string"
  1502. %printer { fprintf (yyo, "%d", $$); } <u.ival>
  1503. %destructor { free ($$); } <u.sval>
  1504. /* In yylex(). */
  1505. yylval.u.ival = 42; return INT;
  1506. yylval.u.sval = "42"; return STRING;
  1507. ** Variable parse.error
  1508. This variable controls the verbosity of error messages. The use of the
  1509. %error-verbose directive is deprecated in favor of "%define parse.error
  1510. verbose".
  1511. ** Deprecated %define variable names
  1512. The following variables have been renamed for consistency. Backward
  1513. compatibility is ensured, but upgrading is recommended.
  1514. lr.default-reductions -> lr.default-reduction
  1515. lr.keep-unreachable-states -> lr.keep-unreachable-state
  1516. namespace -> api.namespace
  1517. stype -> api.value.type
  1518. ** Semantic predicates
  1519. Contributed by Paul Hilfinger.
  1520. The new, experimental, semantic-predicate feature allows actions of the
  1521. form "%?{ BOOLEAN-EXPRESSION }", which cause syntax errors (as for
  1522. YYERROR) if the expression evaluates to 0, and are evaluated immediately
  1523. in GLR parsers, rather than being deferred. The result is that they allow
  1524. the programmer to prune possible parses based on the values of run-time
  1525. expressions.
  1526. ** The directive %expect-rr is now an error in non GLR mode
  1527. It used to be an error only if used in non GLR mode, _and_ if there are
  1528. reduce/reduce conflicts.
  1529. ** Tokens are numbered in their order of appearance
  1530. Contributed by Valentin Tolmer.
  1531. With '%token A B', A had a number less than the one of B. However,
  1532. precedence declarations used to generate a reversed order. This is now
  1533. fixed, and introducing tokens with any of %token, %left, %right,
  1534. %precedence, or %nonassoc yields the same result.
  1535. When mixing declarations of tokens with a literal character (e.g., 'a') or
  1536. with an identifier (e.g., B) in a precedence declaration, Bison numbered
  1537. the literal characters first. For example
  1538. %right A B 'c' 'd'
  1539. would lead to the tokens declared in this order: 'c' 'd' A B. Again, the
  1540. input order is now preserved.
  1541. These changes were made so that one can remove useless precedence and
  1542. associativity declarations (i.e., map %nonassoc, %left or %right to
  1543. %precedence, or to %token) and get exactly the same output.
  1544. ** Useless precedence and associativity
  1545. Contributed by Valentin Tolmer.
  1546. When developing and maintaining a grammar, useless associativity and
  1547. precedence directives are common. They can be a nuisance: new ambiguities
  1548. arising are sometimes masked because their conflicts are resolved due to
  1549. the extra precedence or associativity information. Furthermore, it can
  1550. hinder the comprehension of a new grammar: one will wonder about the role
  1551. of a precedence, where in fact it is useless. The following changes aim
  1552. at detecting and reporting these extra directives.
  1553. *** Precedence warning category
  1554. A new category of warning, -Wprecedence, was introduced. It flags the
  1555. useless precedence and associativity directives.
  1556. *** Useless associativity
  1557. Bison now warns about symbols with a declared associativity that is never
  1558. used to resolve conflicts. In that case, using %precedence is sufficient;
  1559. the parsing tables will remain unchanged. Solving these warnings may raise
  1560. useless precedence warnings, as the symbols no longer have associativity.
  1561. For example:
  1562. %left '+'
  1563. %left '*'
  1564. %%
  1565. exp:
  1566. "number"
  1567. | exp '+' "number"
  1568. | exp '*' exp
  1569. ;
  1570. will produce a
  1571. warning: useless associativity for '+', use %precedence [-Wprecedence]
  1572. %left '+'
  1573. ^^^
  1574. *** Useless precedence
  1575. Bison now warns about symbols with a declared precedence and no declared
  1576. associativity (i.e., declared with %precedence), and whose precedence is
  1577. never used. In that case, the symbol can be safely declared with %token
  1578. instead, without modifying the parsing tables. For example:
  1579. %precedence '='
  1580. %%
  1581. exp: "var" '=' "number";
  1582. will produce a
  1583. warning: useless precedence for '=' [-Wprecedence]
  1584. %precedence '='
  1585. ^^^
  1586. *** Useless precedence and associativity
  1587. In case of both useless precedence and associativity, the issue is flagged
  1588. as follows:
  1589. %nonassoc '='
  1590. %%
  1591. exp: "var" '=' "number";
  1592. The warning is:
  1593. warning: useless precedence and associativity for '=' [-Wprecedence]
  1594. %nonassoc '='
  1595. ^^^
  1596. ** Empty rules
  1597. With help from Joel E. Denny and Gabriel Rassoul.
  1598. Empty rules (i.e., with an empty right-hand side) can now be explicitly
  1599. marked by the new %empty directive. Using %empty on a non-empty rule is
  1600. an error. The new -Wempty-rule warning reports empty rules without
  1601. %empty. On the following grammar:
  1602. %%
  1603. s: a b c;
  1604. a: ;
  1605. b: %empty;
  1606. c: 'a' %empty;
  1607. bison reports:
  1608. 3.4-5: warning: empty rule without %empty [-Wempty-rule]
  1609. a: {}
  1610. ^^
  1611. 5.8-13: error: %empty on non-empty rule
  1612. c: 'a' %empty {};
  1613. ^^^^^^
  1614. ** Java skeleton improvements
  1615. The constants for token names were moved to the Lexer interface. Also, it
  1616. is possible to add code to the parser's constructors using "%code init"
  1617. and "%define init_throws".
  1618. Contributed by Paolo Bonzini.
  1619. The Java skeleton now supports push parsing.
  1620. Contributed by Dennis Heimbigner.
  1621. ** C++ skeletons improvements
  1622. *** The parser header is no longer mandatory (lalr1.cc, glr.cc)
  1623. Using %defines is now optional. Without it, the needed support classes
  1624. are defined in the generated parser, instead of additional files (such as
  1625. location.hh, position.hh and stack.hh).
  1626. *** Locations are no longer mandatory (lalr1.cc, glr.cc)
  1627. Both lalr1.cc and glr.cc no longer require %location.
  1628. *** syntax_error exception (lalr1.cc)
  1629. The C++ parser features a syntax_error exception, which can be
  1630. thrown from the scanner or from user rules to raise syntax errors.
  1631. This facilitates reporting errors caught in sub-functions (e.g.,
  1632. rejecting too large integral literals from a conversion function
  1633. used by the scanner, or rejecting invalid combinations from a
  1634. factory invoked by the user actions).
  1635. *** %define api.value.type variant
  1636. This is based on a submission from Michiel De Wilde. With help
  1637. from Théophile Ranquet.
  1638. In this mode, complex C++ objects can be used as semantic values. For
  1639. instance:
  1640. %token <::std::string> TEXT;
  1641. %token <int> NUMBER;
  1642. %token SEMICOLON ";"
  1643. %type <::std::string> item;
  1644. %type <::std::list<std::string>> list;
  1645. %%
  1646. result:
  1647. list { std::cout << $1 << std::endl; }
  1648. ;
  1649. list:
  1650. %empty { /* Generates an empty string list. */ }
  1651. | list item ";" { std::swap ($$, $1); $$.push_back ($2); }
  1652. ;
  1653. item:
  1654. TEXT { std::swap ($$, $1); }
  1655. | NUMBER { $$ = string_cast ($1); }
  1656. ;
  1657. *** %define api.token.constructor
  1658. When variants are enabled, Bison can generate functions to build the
  1659. tokens. This guarantees that the token type (e.g., NUMBER) is consistent
  1660. with the semantic value (e.g., int):
  1661. parser::symbol_type yylex ()
  1662. {
  1663. parser::location_type loc = ...;
  1664. ...
  1665. return parser::make_TEXT ("Hello, world!", loc);
  1666. ...
  1667. return parser::make_NUMBER (42, loc);
  1668. ...
  1669. return parser::make_SEMICOLON (loc);
  1670. ...
  1671. }
  1672. *** C++ locations
  1673. There are operator- and operator-= for 'location'. Negative line/column
  1674. increments can no longer underflow the resulting value.
  1675. * Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
  1676. ** Bug fixes
  1677. *** Fix compiler attribute portability (yacc.c)
  1678. With locations enabled, __attribute__ was used unprotected.
  1679. *** Fix some compiler warnings (lalr1.cc)
  1680. * Noteworthy changes in release 2.7 (2012-12-12) [stable]
  1681. ** Bug fixes
  1682. Warnings about uninitialized yylloc in yyparse have been fixed.
  1683. Restored C90 compliance (yet no report was ever made).
  1684. ** Diagnostics are improved
  1685. Contributed by Théophile Ranquet.
  1686. *** Changes in the format of error messages
  1687. This used to be the format of many error reports:
  1688. input.y:2.7-12: %type redeclaration for exp
  1689. input.y:1.7-12: previous declaration
  1690. It is now:
  1691. input.y:2.7-12: error: %type redeclaration for exp
  1692. input.y:1.7-12: previous declaration
  1693. *** New format for error reports: carets
  1694. Caret errors have been added to Bison:
  1695. input.y:2.7-12: error: %type redeclaration for exp
  1696. %type <sval> exp
  1697. ^^^^^^
  1698. input.y:1.7-12: previous declaration
  1699. %type <ival> exp
  1700. ^^^^^^
  1701. or
  1702. input.y:3.20-23: error: ambiguous reference: '$exp'
  1703. exp: exp '+' exp { $exp = $1 + $3; };
  1704. ^^^^
  1705. input.y:3.1-3: refers to: $exp at $$
  1706. exp: exp '+' exp { $exp = $1 + $3; };
  1707. ^^^
  1708. input.y:3.6-8: refers to: $exp at $1
  1709. exp: exp '+' exp { $exp = $1 + $3; };
  1710. ^^^
  1711. input.y:3.14-16: refers to: $exp at $3
  1712. exp: exp '+' exp { $exp = $1 + $3; };
  1713. ^^^
  1714. The default behavior for now is still not to display these unless
  1715. explicitly asked with -fcaret (or -fall). However, in a later release, it
  1716. will be made the default behavior (but may still be deactivated with
  1717. -fno-caret).
  1718. ** New value for %define variable: api.pure full
  1719. The %define variable api.pure requests a pure (reentrant) parser. However,
  1720. for historical reasons, using it in a location-tracking Yacc parser
  1721. resulted in a yyerror function that did not take a location as a
  1722. parameter. With this new value, the user may request a better pure parser,
  1723. where yyerror does take a location as a parameter (in location-tracking
  1724. parsers).
  1725. The use of "%define api.pure true" is deprecated in favor of this new
  1726. "%define api.pure full".
  1727. ** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
  1728. The %define variable api.location.type defines the name of the type to use
  1729. for locations. When defined, Bison no longer generates the position.hh
  1730. and location.hh files, nor does the parser will include them: the user is
  1731. then responsible to define her type.
  1732. This can be used in programs with several parsers to factor their location
  1733. and position files: let one of them generate them, and the others just use
  1734. them.
  1735. This feature was actually introduced, but not documented, in Bison 2.5,
  1736. under the name "location_type" (which is maintained for backward
  1737. compatibility).
  1738. For consistency, lalr1.java's %define variables location_type and
  1739. position_type are deprecated in favor of api.location.type and
  1740. api.position.type.
  1741. ** Exception safety (lalr1.cc)
  1742. The parse function now catches exceptions, uses the %destructors to
  1743. release memory (the lookahead symbol and the symbols pushed on the stack)
  1744. before re-throwing the exception.
  1745. This feature is somewhat experimental. User feedback would be
  1746. appreciated.
  1747. ** Graph improvements in DOT and XSLT
  1748. Contributed by Théophile Ranquet.
  1749. The graphical presentation of the states is more readable: their shape is
  1750. now rectangular, the state number is clearly displayed, and the items are
  1751. numbered and left-justified.
  1752. The reductions are now explicitly represented as transitions to other
  1753. diamond shaped nodes.
  1754. These changes are present in both --graph output and xml2dot.xsl XSLT
  1755. processing, with minor (documented) differences.
  1756. ** %language is no longer an experimental feature.
  1757. The introduction of this feature, in 2.4, was four years ago. The
  1758. --language option and the %language directive are no longer experimental.
  1759. ** Documentation
  1760. The sections about shift/reduce and reduce/reduce conflicts resolution
  1761. have been fixed and extended.
  1762. Although introduced more than four years ago, XML and Graphviz reports
  1763. were not properly documented.
  1764. The translation of midrule actions is now described.
  1765. * Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
  1766. We consider compiler warnings about Bison generated parsers to be bugs.
  1767. Rather than working around them in your own project, please consider
  1768. reporting them to us.
  1769. ** Bug fixes
  1770. Warnings about uninitialized yylval and/or yylloc for push parsers with a
  1771. pure interface have been fixed for GCC 4.0 up to 4.8, and Clang 2.9 to
  1772. 3.2.
  1773. Other issues in the test suite have been addressed.
  1774. Null characters are correctly displayed in error messages.
  1775. When possible, yylloc is correctly initialized before calling yylex. It
  1776. is no longer necessary to initialize it in the %initial-action.
  1777. * Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
  1778. Bison 2.6.3's --version was incorrect. This release fixes this issue.
  1779. * Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
  1780. ** Bug fixes
  1781. Bugs and portability issues in the test suite have been fixed.
  1782. Some errors in translations have been addressed, and --help now directs
  1783. users to the appropriate place to report them.
  1784. Stray Info files shipped by accident are removed.
  1785. Incorrect definitions of YY_, issued by yacc.c when no parser header is
  1786. generated, are removed.
  1787. All the generated headers are self-contained.
  1788. ** Header guards (yacc.c, glr.c, glr.cc)
  1789. In order to avoid collisions, the header guards are now
  1790. YY_<PREFIX>_<FILE>_INCLUDED, instead of merely <PREFIX>_<FILE>.
  1791. For instance the header generated from
  1792. %define api.prefix "calc"
  1793. %defines "lib/parse.h"
  1794. will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
  1795. ** Fix compiler warnings in the generated parser (yacc.c, glr.c)
  1796. The compilation of pure parsers (%define api.pure) can trigger GCC
  1797. warnings such as:
  1798. input.c: In function 'yyparse':
  1799. input.c:1503:12: warning: 'yylval' may be used uninitialized in this
  1800. function [-Wmaybe-uninitialized]
  1801. *++yyvsp = yylval;
  1802. ^
  1803. This is now fixed; pragmas to avoid these warnings are no longer needed.
  1804. Warnings from clang ("equality comparison with extraneous parentheses" and
  1805. "function declared 'noreturn' should not return") have also been
  1806. addressed.
  1807. * Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
  1808. ** Bug fixes
  1809. Buffer overruns, complaints from Flex, and portability issues in the test
  1810. suite have been fixed.
  1811. ** Spaces in %lex- and %parse-param (lalr1.cc, glr.cc)
  1812. Trailing end-of-lines in %parse-param or %lex-param would result in
  1813. invalid C++. This is fixed.
  1814. ** Spurious spaces and end-of-lines
  1815. The generated files no longer end (nor start) with empty lines.
  1816. * Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
  1817. Bison no longer executes user-specified M4 code when processing a grammar.
  1818. ** Future Changes
  1819. In addition to the removal of the features announced in Bison 2.6, the
  1820. next major release will remove the "Temporary hack for adding a semicolon
  1821. to the user action", as announced in the release 2.5. Instead of:
  1822. exp: exp "+" exp { $$ = $1 + $3 };
  1823. write:
  1824. exp: exp "+" exp { $$ = $1 + $3; };
  1825. ** Bug fixes
  1826. *** Type names are now properly escaped.
  1827. *** glr.cc: set_debug_level and debug_level work as expected.
  1828. *** Stray @ or $ in actions
  1829. While Bison used to warn about stray $ or @ in action rules, it did not
  1830. for other actions such as printers, destructors, or initial actions. It
  1831. now does.
  1832. ** Type names in actions
  1833. For consistency with rule actions, it is now possible to qualify $$ by a
  1834. type-name in destructors, printers, and initial actions. For instance:
  1835. %printer { fprintf (yyo, "(%d, %f)", $<ival>$, $<fval>$); } <*> <>;
  1836. will display two values for each typed and untyped symbol (provided
  1837. that YYSTYPE has both "ival" and "fval" fields).
  1838. * Noteworthy changes in release 2.6 (2012-07-19) [stable]
  1839. ** Future changes
  1840. The next major release of Bison will drop support for the following
  1841. deprecated features. Please report disagreements to bug-bison@gnu.org.
  1842. *** K&R C parsers
  1843. Support for generating parsers in K&R C will be removed. Parsers
  1844. generated for C support ISO C90, and are tested with ISO C99 and ISO C11
  1845. compilers.
  1846. *** Features deprecated since Bison 1.875
  1847. The definitions of yystype and yyltype will be removed; use YYSTYPE and
  1848. YYLTYPE.
  1849. YYPARSE_PARAM and YYLEX_PARAM, deprecated in favor of %parse-param and
  1850. %lex-param, will no longer be supported.
  1851. Support for the preprocessor symbol YYERROR_VERBOSE will be removed, use
  1852. %error-verbose.
  1853. *** The generated header will be included (yacc.c)
  1854. Instead of duplicating the content of the generated header (definition of
  1855. YYSTYPE, yyparse declaration etc.), the generated parser will include it,
  1856. as is already the case for GLR or C++ parsers. This change is deferred
  1857. because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
  1858. it.
  1859. ** Generated Parser Headers
  1860. *** Guards (yacc.c, glr.c, glr.cc)
  1861. The generated headers are now guarded, as is already the case for C++
  1862. parsers (lalr1.cc). For instance, with --defines=foo.h:
  1863. #ifndef YY_FOO_H
  1864. # define YY_FOO_H
  1865. ...
  1866. #endif /* !YY_FOO_H */
  1867. *** New declarations (yacc.c, glr.c)
  1868. The generated header now declares yydebug and yyparse. Both honor
  1869. --name-prefix=bar_, and yield
  1870. int bar_parse (void);
  1871. rather than
  1872. #define yyparse bar_parse
  1873. int yyparse (void);
  1874. in order to facilitate the inclusion of several parser headers inside a
  1875. single compilation unit.
  1876. *** Exported symbols in C++
  1877. The symbols YYTOKEN_TABLE and YYERROR_VERBOSE, which were defined in the
  1878. header, are removed, as they prevent the possibility of including several
  1879. generated headers from a single compilation unit.
  1880. *** YYLSP_NEEDED
  1881. For the same reasons, the undocumented and unused macro YYLSP_NEEDED is no
  1882. longer defined.
  1883. ** New %define variable: api.prefix
  1884. Now that the generated headers are more complete and properly protected
  1885. against multiple inclusions, constant names, such as YYSTYPE are a
  1886. problem. While yyparse and others are properly renamed by %name-prefix,
  1887. YYSTYPE, YYDEBUG and others have never been affected by it. Because it
  1888. would introduce backward compatibility issues in projects not expecting
  1889. YYSTYPE to be renamed, instead of changing the behavior of %name-prefix,
  1890. it is deprecated in favor of a new %define variable: api.prefix.
  1891. The following examples compares both:
  1892. %name-prefix "bar_" | %define api.prefix "bar_"
  1893. %token <ival> FOO %token <ival> FOO
  1894. %union { int ival; } %union { int ival; }
  1895. %% %%
  1896. exp: 'a'; exp: 'a';
  1897. bison generates:
  1898. #ifndef BAR_FOO_H #ifndef BAR_FOO_H
  1899. # define BAR_FOO_H # define BAR_FOO_H
  1900. /* Enabling traces. */ /* Enabling traces. */
  1901. # ifndef YYDEBUG | # ifndef BAR_DEBUG
  1902. > # if defined YYDEBUG
  1903. > # if YYDEBUG
  1904. > # define BAR_DEBUG 1
  1905. > # else
  1906. > # define BAR_DEBUG 0
  1907. > # endif
  1908. > # else
  1909. # define YYDEBUG 0 | # define BAR_DEBUG 0
  1910. > # endif
  1911. # endif | # endif
  1912. # if YYDEBUG | # if BAR_DEBUG
  1913. extern int bar_debug; extern int bar_debug;
  1914. # endif # endif
  1915. /* Tokens. */ /* Tokens. */
  1916. # ifndef YYTOKENTYPE | # ifndef BAR_TOKENTYPE
  1917. # define YYTOKENTYPE | # define BAR_TOKENTYPE
  1918. enum yytokentype { | enum bar_tokentype {
  1919. FOO = 258 FOO = 258
  1920. }; };
  1921. # endif # endif
  1922. #if ! defined YYSTYPE \ | #if ! defined BAR_STYPE \
  1923. && ! defined YYSTYPE_IS_DECLARED | && ! defined BAR_STYPE_IS_DECLARED
  1924. typedef union YYSTYPE | typedef union BAR_STYPE
  1925. { {
  1926. int ival; int ival;
  1927. } YYSTYPE; | } BAR_STYPE;
  1928. # define YYSTYPE_IS_DECLARED 1 | # define BAR_STYPE_IS_DECLARED 1
  1929. #endif #endif
  1930. extern YYSTYPE bar_lval; | extern BAR_STYPE bar_lval;
  1931. int bar_parse (void); int bar_parse (void);
  1932. #endif /* !BAR_FOO_H */ #endif /* !BAR_FOO_H */
  1933. * Noteworthy changes in release 2.5.1 (2012-06-05) [stable]
  1934. ** Future changes:
  1935. The next major release will drop support for generating parsers in K&R C.
  1936. ** yacc.c: YYBACKUP works as expected.
  1937. ** glr.c improvements:
  1938. *** Location support is eliminated when not requested:
  1939. GLR parsers used to include location-related code even when locations were
  1940. not requested, and therefore not even usable.
  1941. *** __attribute__ is preserved:
  1942. __attribute__ is no longer disabled when __STRICT_ANSI__ is defined (i.e.,
  1943. when -std is passed to GCC).
  1944. ** lalr1.java: several fixes:
  1945. The Java parser no longer throws ArrayIndexOutOfBoundsException if the
  1946. first token leads to a syntax error. Some minor clean ups.
  1947. ** Changes for C++:
  1948. *** C++11 compatibility:
  1949. C and C++ parsers use "nullptr" instead of "0" when __cplusplus is 201103L
  1950. or higher.
  1951. *** Header guards
  1952. The header files such as "parser.hh", "location.hh", etc. used a constant
  1953. name for preprocessor guards, for instance:
  1954. #ifndef BISON_LOCATION_HH
  1955. # define BISON_LOCATION_HH
  1956. ...
  1957. #endif // !BISON_LOCATION_HH
  1958. The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
  1959. case characters are converted to upper case, and series of
  1960. non-alphanumerical characters are converted to an underscore.
  1961. With "bison -o lang++/parser.cc", "location.hh" would now include:
  1962. #ifndef YY_LANG_LOCATION_HH
  1963. # define YY_LANG_LOCATION_HH
  1964. ...
  1965. #endif // !YY_LANG_LOCATION_HH
  1966. *** C++ locations:
  1967. The position and location constructors (and their initialize methods)
  1968. accept new arguments for line and column. Several issues in the
  1969. documentation were fixed.
  1970. ** liby is no longer asking for "rpl_fprintf" on some platforms.
  1971. ** Changes in the manual:
  1972. *** %printer is documented
  1973. The "%printer" directive, supported since at least Bison 1.50, is finally
  1974. documented. The "mfcalc" example is extended to demonstrate it.
  1975. For consistency with the C skeletons, the C++ parsers now also support
  1976. "yyoutput" (as an alias to "debug_stream ()").
  1977. *** Several improvements have been made:
  1978. The layout for grammar excerpts was changed to a more compact scheme.
  1979. Named references are motivated. The description of the automaton
  1980. description file (*.output) is updated to the current format. Incorrect
  1981. index entries were fixed. Some other errors were fixed.
  1982. ** Building bison:
  1983. *** Conflicting prototypes with recent/modified Flex.
  1984. Fixed build problems with the current, unreleased, version of Flex, and
  1985. some modified versions of 2.5.35, which have modified function prototypes.
  1986. *** Warnings during the build procedure have been eliminated.
  1987. *** Several portability problems in the test suite have been fixed:
  1988. This includes warnings with some compilers, unexpected behavior of tools
  1989. such as diff, warning messages from the test suite itself, etc.
  1990. *** The install-pdf target works properly:
  1991. Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
  1992. halts in the middle of its course.
  1993. * Noteworthy changes in release 2.5 (2011-05-14)
  1994. ** Grammar symbol names can now contain non-initial dashes:
  1995. Consistently with directives (such as %error-verbose) and with
  1996. %define variables (e.g. push-pull), grammar symbol names may contain
  1997. dashes in any position except the beginning. This is a GNU
  1998. extension over POSIX Yacc. Thus, use of this extension is reported
  1999. by -Wyacc and rejected in Yacc mode (--yacc).
  2000. ** Named references:
  2001. Historically, Yacc and Bison have supported positional references
  2002. ($n, $$) to allow access to symbol values from inside of semantic
  2003. actions code.
  2004. Starting from this version, Bison can also accept named references.
  2005. When no ambiguity is possible, original symbol names may be used
  2006. as named references:
  2007. if_stmt : "if" cond_expr "then" then_stmt ';'
  2008. { $if_stmt = mk_if_stmt($cond_expr, $then_stmt); }
  2009. In the more common case, explicit names may be declared:
  2010. stmt[res] : "if" expr[cond] "then" stmt[then] "else" stmt[else] ';'
  2011. { $res = mk_if_stmt($cond, $then, $else); }
  2012. Location information is also accessible using @name syntax. When
  2013. accessing symbol names containing dots or dashes, explicit bracketing
  2014. ($[sym.1]) must be used.
  2015. These features are experimental in this version. More user feedback
  2016. will help to stabilize them.
  2017. Contributed by Alex Rozenman.
  2018. ** IELR(1) and canonical LR(1):
  2019. IELR(1) is a minimal LR(1) parser table generation algorithm. That
  2020. is, given any context-free grammar, IELR(1) generates parser tables
  2021. with the full language-recognition power of canonical LR(1) but with
  2022. nearly the same number of parser states as LALR(1). This reduction
  2023. in parser states is often an order of magnitude. More importantly,
  2024. because canonical LR(1)'s extra parser states may contain duplicate
  2025. conflicts in the case of non-LR(1) grammars, the number of conflicts
  2026. for IELR(1) is often an order of magnitude less as well. This can
  2027. significantly reduce the complexity of developing of a grammar.
  2028. Bison can now generate IELR(1) and canonical LR(1) parser tables in
  2029. place of its traditional LALR(1) parser tables, which remain the
  2030. default. You can specify the type of parser tables in the grammar
  2031. file with these directives:
  2032. %define lr.type lalr
  2033. %define lr.type ielr
  2034. %define lr.type canonical-lr
  2035. The default-reduction optimization in the parser tables can also be
  2036. adjusted using "%define lr.default-reductions". For details on both
  2037. of these features, see the new section "Tuning LR" in the Bison
  2038. manual.
  2039. These features are experimental. More user feedback will help to
  2040. stabilize them.
  2041. ** LAC (Lookahead Correction) for syntax error handling
  2042. Contributed by Joel E. Denny.
  2043. Canonical LR, IELR, and LALR can suffer from a couple of problems
  2044. upon encountering a syntax error. First, the parser might perform
  2045. additional parser stack reductions before discovering the syntax
  2046. error. Such reductions can perform user semantic actions that are
  2047. unexpected because they are based on an invalid token, and they
  2048. cause error recovery to begin in a different syntactic context than
  2049. the one in which the invalid token was encountered. Second, when
  2050. verbose error messages are enabled (with %error-verbose or the
  2051. obsolete "#define YYERROR_VERBOSE"), the expected token list in the
  2052. syntax error message can both contain invalid tokens and omit valid
  2053. tokens.
  2054. The culprits for the above problems are %nonassoc, default
  2055. reductions in inconsistent states, and parser state merging. Thus,
  2056. IELR and LALR suffer the most. Canonical LR can suffer only if
  2057. %nonassoc is used or if default reductions are enabled for
  2058. inconsistent states.
  2059. LAC is a new mechanism within the parsing algorithm that solves
  2060. these problems for canonical LR, IELR, and LALR without sacrificing
  2061. %nonassoc, default reductions, or state merging. When LAC is in
  2062. use, canonical LR and IELR behave almost exactly the same for both
  2063. syntactically acceptable and syntactically unacceptable input.
  2064. While LALR still does not support the full language-recognition
  2065. power of canonical LR and IELR, LAC at least enables LALR's syntax
  2066. error handling to correctly reflect LALR's language-recognition
  2067. power.
  2068. Currently, LAC is only supported for deterministic parsers in C.
  2069. You can enable LAC with the following directive:
  2070. %define parse.lac full
  2071. See the new section "LAC" in the Bison manual for additional
  2072. details including a few caveats.
  2073. LAC is an experimental feature. More user feedback will help to
  2074. stabilize it.
  2075. ** %define improvements:
  2076. *** Can now be invoked via the command line:
  2077. Each of these command-line options
  2078. -D NAME[=VALUE]
  2079. --define=NAME[=VALUE]
  2080. -F NAME[=VALUE]
  2081. --force-define=NAME[=VALUE]
  2082. is equivalent to this grammar file declaration
  2083. %define NAME ["VALUE"]
  2084. except that the manner in which Bison processes multiple definitions
  2085. for the same NAME differs. Most importantly, -F and --force-define
  2086. quietly override %define, but -D and --define do not. For further
  2087. details, see the section "Bison Options" in the Bison manual.
  2088. *** Variables renamed:
  2089. The following %define variables
  2090. api.push_pull
  2091. lr.keep_unreachable_states
  2092. have been renamed to
  2093. api.push-pull
  2094. lr.keep-unreachable-states
  2095. The old names are now deprecated but will be maintained indefinitely
  2096. for backward compatibility.
  2097. *** Values no longer need to be quoted in the grammar file:
  2098. If a %define value is an identifier, it no longer needs to be placed
  2099. within quotations marks. For example,
  2100. %define api.push-pull "push"
  2101. can be rewritten as
  2102. %define api.push-pull push
  2103. *** Unrecognized variables are now errors not warnings.
  2104. *** Multiple invocations for any variable is now an error not a warning.
  2105. ** Unrecognized %code qualifiers are now errors not warnings.
  2106. ** Character literals not of length one:
  2107. Previously, Bison quietly converted all character literals to length
  2108. one. For example, without warning, Bison interpreted the operators in
  2109. the following grammar to be the same token:
  2110. exp: exp '++'
  2111. | exp '+' exp
  2112. ;
  2113. Bison now warns when a character literal is not of length one. In
  2114. some future release, Bison will start reporting an error instead.
  2115. ** Destructor calls fixed for lookaheads altered in semantic actions:
  2116. Previously for deterministic parsers in C, if a user semantic action
  2117. altered yychar, the parser in some cases used the old yychar value to
  2118. determine which destructor to call for the lookahead upon a syntax
  2119. error or upon parser return. This bug has been fixed.
  2120. ** C++ parsers use YYRHSLOC:
  2121. Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
  2122. macro and use it in the default YYLLOC_DEFAULT. You are encouraged
  2123. to use it. If, for instance, your location structure has "first"
  2124. and "last" members, instead of
  2125. # define YYLLOC_DEFAULT(Current, Rhs, N) \
  2126. do \
  2127. if (N) \
  2128. { \
  2129. (Current).first = (Rhs)[1].location.first; \
  2130. (Current).last = (Rhs)[N].location.last; \
  2131. } \
  2132. else \
  2133. { \
  2134. (Current).first = (Current).last = (Rhs)[0].location.last; \
  2135. } \
  2136. while (false)
  2137. use:
  2138. # define YYLLOC_DEFAULT(Current, Rhs, N) \
  2139. do \
  2140. if (N) \
  2141. { \
  2142. (Current).first = YYRHSLOC (Rhs, 1).first; \
  2143. (Current).last = YYRHSLOC (Rhs, N).last; \
  2144. } \
  2145. else \
  2146. { \
  2147. (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \
  2148. } \
  2149. while (false)
  2150. ** YYLLOC_DEFAULT in C++:
  2151. The default implementation of YYLLOC_DEFAULT used to be issued in
  2152. the header file. It is now output in the implementation file, after
  2153. the user %code sections so that its #ifndef guard does not try to
  2154. override the user's YYLLOC_DEFAULT if provided.
  2155. ** YYFAIL now produces warnings and Java parsers no longer implement it:
  2156. YYFAIL has existed for many years as an undocumented feature of
  2157. deterministic parsers in C generated by Bison. More recently, it was
  2158. a documented feature of Bison's experimental Java parsers. As
  2159. promised in Bison 2.4.2's NEWS entry, any appearance of YYFAIL in a
  2160. semantic action now produces a deprecation warning, and Java parsers
  2161. no longer implement YYFAIL at all. For further details, including a
  2162. discussion of how to suppress C preprocessor warnings about YYFAIL
  2163. being unused, see the Bison 2.4.2 NEWS entry.
  2164. ** Temporary hack for adding a semicolon to the user action:
  2165. Previously, Bison appended a semicolon to every user action for
  2166. reductions when the output language defaulted to C (specifically, when
  2167. neither %yacc, %language, %skeleton, or equivalent command-line
  2168. options were specified). This allowed actions such as
  2169. exp: exp "+" exp { $$ = $1 + $3 };
  2170. instead of
  2171. exp: exp "+" exp { $$ = $1 + $3; };
  2172. As a first step in removing this misfeature, Bison now issues a
  2173. warning when it appends a semicolon. Moreover, in cases where Bison
  2174. cannot easily determine whether a semicolon is needed (for example, an
  2175. action ending with a cpp directive or a braced compound initializer),
  2176. it no longer appends one. Thus, the C compiler might now complain
  2177. about a missing semicolon where it did not before. Future releases of
  2178. Bison will cease to append semicolons entirely.
  2179. ** Verbose syntax error message fixes:
  2180. When %error-verbose or the obsolete "#define YYERROR_VERBOSE" is
  2181. specified, syntax error messages produced by the generated parser
  2182. include the unexpected token as well as a list of expected tokens.
  2183. The effect of %nonassoc on these verbose messages has been corrected
  2184. in two ways, but a more complete fix requires LAC, described above:
  2185. *** When %nonassoc is used, there can exist parser states that accept no
  2186. tokens, and so the parser does not always require a lookahead token
  2187. in order to detect a syntax error. Because no unexpected token or
  2188. expected tokens can then be reported, the verbose syntax error
  2189. message described above is suppressed, and the parser instead
  2190. reports the simpler message, "syntax error". Previously, this
  2191. suppression was sometimes erroneously triggered by %nonassoc when a
  2192. lookahead was actually required. Now verbose messages are
  2193. suppressed only when all previous lookaheads have already been
  2194. shifted or discarded.
  2195. *** Previously, the list of expected tokens erroneously included tokens
  2196. that would actually induce a syntax error because conflicts for them
  2197. were resolved with %nonassoc in the current parser state. Such
  2198. tokens are now properly omitted from the list.
  2199. *** Expected token lists are still often wrong due to state merging
  2200. (from LALR or IELR) and default reductions, which can both add
  2201. invalid tokens and subtract valid tokens. Canonical LR almost
  2202. completely fixes this problem by eliminating state merging and
  2203. default reductions. However, there is one minor problem left even
  2204. when using canonical LR and even after the fixes above. That is,
  2205. if the resolution of a conflict with %nonassoc appears in a later
  2206. parser state than the one at which some syntax error is
  2207. discovered, the conflicted token is still erroneously included in
  2208. the expected token list. Bison's new LAC implementation,
  2209. described above, eliminates this problem and the need for
  2210. canonical LR. However, LAC is still experimental and is disabled
  2211. by default.
  2212. ** Java skeleton fixes:
  2213. *** A location handling bug has been fixed.
  2214. *** The top element of each of the value stack and location stack is now
  2215. cleared when popped so that it can be garbage collected.
  2216. *** Parser traces now print the top element of the stack.
  2217. ** -W/--warnings fixes:
  2218. *** Bison now properly recognizes the "no-" versions of categories:
  2219. For example, given the following command line, Bison now enables all
  2220. warnings except warnings for incompatibilities with POSIX Yacc:
  2221. bison -Wall,no-yacc gram.y
  2222. *** Bison now treats S/R and R/R conflicts like other warnings:
  2223. Previously, conflict reports were independent of Bison's normal
  2224. warning system. Now, Bison recognizes the warning categories
  2225. "conflicts-sr" and "conflicts-rr". This change has important
  2226. consequences for the -W and --warnings command-line options. For
  2227. example:
  2228. bison -Wno-conflicts-sr gram.y # S/R conflicts not reported
  2229. bison -Wno-conflicts-rr gram.y # R/R conflicts not reported
  2230. bison -Wnone gram.y # no conflicts are reported
  2231. bison -Werror gram.y # any conflict is an error
  2232. However, as before, if the %expect or %expect-rr directive is
  2233. specified, an unexpected number of conflicts is an error, and an
  2234. expected number of conflicts is not reported, so -W and --warning
  2235. then have no effect on the conflict report.
  2236. *** The "none" category no longer disables a preceding "error":
  2237. For example, for the following command line, Bison now reports
  2238. errors instead of warnings for incompatibilities with POSIX Yacc:
  2239. bison -Werror,none,yacc gram.y
  2240. *** The "none" category now disables all Bison warnings:
  2241. Previously, the "none" category disabled only Bison warnings for
  2242. which there existed a specific -W/--warning category. However,
  2243. given the following command line, Bison is now guaranteed to
  2244. suppress all warnings:
  2245. bison -Wnone gram.y
  2246. ** Precedence directives can now assign token number 0:
  2247. Since Bison 2.3b, which restored the ability of precedence
  2248. directives to assign token numbers, doing so for token number 0 has
  2249. produced an assertion failure. For example:
  2250. %left END 0
  2251. This bug has been fixed.
  2252. * Noteworthy changes in release 2.4.3 (2010-08-05)
  2253. ** Bison now obeys -Werror and --warnings=error for warnings about
  2254. grammar rules that are useless in the parser due to conflicts.
  2255. ** Problems with spawning M4 on at least FreeBSD 8 and FreeBSD 9 have
  2256. been fixed.
  2257. ** Failures in the test suite for GCC 4.5 have been fixed.
  2258. ** Failures in the test suite for some versions of Sun Studio C++ have
  2259. been fixed.
  2260. ** Contrary to Bison 2.4.2's NEWS entry, it has been decided that
  2261. warnings about undefined %prec identifiers will not be converted to
  2262. errors in Bison 2.5. They will remain warnings, which should be
  2263. sufficient for POSIX while avoiding backward compatibility issues.
  2264. ** Minor documentation fixes.
  2265. * Noteworthy changes in release 2.4.2 (2010-03-20)
  2266. ** Some portability problems that resulted in failures and livelocks
  2267. in the test suite on some versions of at least Solaris, AIX, HP-UX,
  2268. RHEL4, and Tru64 have been addressed. As a result, fatal Bison
  2269. errors should no longer cause M4 to report a broken pipe on the
  2270. affected platforms.
  2271. ** "%prec IDENTIFIER" requires IDENTIFIER to be defined separately.
  2272. POSIX specifies that an error be reported for any identifier that does
  2273. not appear on the LHS of a grammar rule and that is not defined by
  2274. %token, %left, %right, or %nonassoc. Bison 2.3b and later lost this
  2275. error report for the case when an identifier appears only after a
  2276. %prec directive. It is now restored. However, for backward
  2277. compatibility with recent Bison releases, it is only a warning for
  2278. now. In Bison 2.5 and later, it will return to being an error.
  2279. [Between the 2.4.2 and 2.4.3 releases, it was decided that this
  2280. warning will not be converted to an error in Bison 2.5.]
  2281. ** Detection of GNU M4 1.4.6 or newer during configure is improved.
  2282. ** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS,
  2283. YYLTYPE_IS_TRIVIAL, and __STRICT_ANSI__ in C/C++ parsers are now
  2284. avoided.
  2285. ** %code is now a permanent feature.
  2286. A traditional Yacc prologue directive is written in the form:
  2287. %{CODE%}
  2288. To provide a more flexible alternative, Bison 2.3b introduced the
  2289. %code directive with the following forms for C/C++:
  2290. %code {CODE}
  2291. %code requires {CODE}
  2292. %code provides {CODE}
  2293. %code top {CODE}
  2294. These forms are now considered permanent features of Bison. See the
  2295. %code entries in the section "Bison Declaration Summary" in the Bison
  2296. manual for a summary of their functionality. See the section
  2297. "Prologue Alternatives" for a detailed discussion including the
  2298. advantages of %code over the traditional Yacc prologue directive.
  2299. Bison's Java feature as a whole including its current usage of %code
  2300. is still considered experimental.
  2301. ** YYFAIL is deprecated and will eventually be removed.
  2302. YYFAIL has existed for many years as an undocumented feature of
  2303. deterministic parsers in C generated by Bison. Previously, it was
  2304. documented for Bison's experimental Java parsers. YYFAIL is no longer
  2305. documented for Java parsers and is formally deprecated in both cases.
  2306. Users are strongly encouraged to migrate to YYERROR, which is
  2307. specified by POSIX.
  2308. Like YYERROR, you can invoke YYFAIL from a semantic action in order to
  2309. induce a syntax error. The most obvious difference from YYERROR is
  2310. that YYFAIL will automatically invoke yyerror to report the syntax
  2311. error so that you don't have to. However, there are several other
  2312. subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
  2313. inherent flaws when %error-verbose or "#define YYERROR_VERBOSE" is
  2314. used. For a more detailed discussion, see:
  2315. https://lists.gnu.org/r/bison-patches/2009-12/msg00024.html
  2316. The upcoming Bison 2.5 will remove YYFAIL from Java parsers, but
  2317. deterministic parsers in C will continue to implement it. However,
  2318. because YYFAIL is already flawed, it seems futile to try to make new
  2319. Bison features compatible with it. Thus, during parser generation,
  2320. Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
  2321. rule action. In a later release, YYFAIL will be disabled for
  2322. %error-verbose and "#define YYERROR_VERBOSE". Eventually, YYFAIL will
  2323. be removed altogether.
  2324. There exists at least one case where Bison 2.5's YYFAIL warning will
  2325. be a false positive. Some projects add phony uses of YYFAIL and other
  2326. Bison-defined macros for the sole purpose of suppressing C
  2327. preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
  2328. To avoid Bison's future warning, such YYFAIL uses can be moved to the
  2329. epilogue (that is, after the second "%%") in the Bison input file. In
  2330. this release (2.4.2), Bison already generates its own code to suppress
  2331. C preprocessor warnings for YYFAIL, so projects can remove their own
  2332. phony uses of YYFAIL if compatibility with Bison releases prior to
  2333. 2.4.2 is not necessary.
  2334. ** Internationalization.
  2335. Fix a regression introduced in Bison 2.4: Under some circumstances,
  2336. message translations were not installed although supported by the
  2337. host system.
  2338. * Noteworthy changes in release 2.4.1 (2008-12-11)
  2339. ** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
  2340. declarations have been fixed.
  2341. ** Temporary hack for adding a semicolon to the user action.
  2342. Bison used to prepend a trailing semicolon at the end of the user
  2343. action for reductions. This allowed actions such as
  2344. exp: exp "+" exp { $$ = $1 + $3 };
  2345. instead of
  2346. exp: exp "+" exp { $$ = $1 + $3; };
  2347. Some grammars still depend on this "feature". Bison 2.4.1 restores
  2348. the previous behavior in the case of C output (specifically, when
  2349. neither %language or %skeleton or equivalent command-line options
  2350. are used) to leave more time for grammars depending on the old
  2351. behavior to be adjusted. Future releases of Bison will disable this
  2352. feature.
  2353. ** A few minor improvements to the Bison manual.
  2354. * Noteworthy changes in release 2.4 (2008-11-02)
  2355. ** %language is an experimental feature.
  2356. We first introduced this feature in test release 2.3b as a cleaner
  2357. alternative to %skeleton. Since then, we have discussed the possibility of
  2358. modifying its effect on Bison's output file names. Thus, in this release,
  2359. we consider %language to be an experimental feature that will likely evolve
  2360. in future releases.
  2361. ** Forward compatibility with GNU M4 has been improved.
  2362. ** Several bugs in the C++ skeleton and the experimental Java skeleton have been
  2363. fixed.
  2364. * Noteworthy changes in release 2.3b (2008-05-27)
  2365. ** The quotes around NAME that used to be required in the following directive
  2366. are now deprecated:
  2367. %define NAME "VALUE"
  2368. ** The directive "%pure-parser" is now deprecated in favor of:
  2369. %define api.pure
  2370. which has the same effect except that Bison is more careful to warn about
  2371. unreasonable usage in the latter case.
  2372. ** Push Parsing
  2373. Bison can now generate an LALR(1) parser in C with a push interface. That
  2374. is, instead of invoking "yyparse", which pulls tokens from "yylex", you can
  2375. push one token at a time to the parser using "yypush_parse", which will
  2376. return to the caller after processing each token. By default, the push
  2377. interface is disabled. Either of the following directives will enable it:
  2378. %define api.push_pull "push" // Just push; does not require yylex.
  2379. %define api.push_pull "both" // Push and pull; requires yylex.
  2380. See the new section "A Push Parser" in the Bison manual for details.
  2381. The current push parsing interface is experimental and may evolve. More user
  2382. feedback will help to stabilize it.
  2383. ** The -g and --graph options now output graphs in Graphviz DOT format,
  2384. not VCG format. Like --graph, -g now also takes an optional FILE argument
  2385. and thus cannot be bundled with other short options.
  2386. ** Java
  2387. Bison can now generate an LALR(1) parser in Java. The skeleton is
  2388. "data/lalr1.java". Consider using the new %language directive instead of
  2389. %skeleton to select it.
  2390. See the new section "Java Parsers" in the Bison manual for details.
  2391. The current Java interface is experimental and may evolve. More user
  2392. feedback will help to stabilize it.
  2393. Contributed by Paolo Bonzini.
  2394. ** %language
  2395. This new directive specifies the programming language of the generated
  2396. parser, which can be C (the default), C++, or Java. Besides the skeleton
  2397. that Bison uses, the directive affects the names of the generated files if
  2398. the grammar file's name ends in ".y".
  2399. ** XML Automaton Report
  2400. Bison can now generate an XML report of the LALR(1) automaton using the new
  2401. "--xml" option. The current XML schema is experimental and may evolve. More
  2402. user feedback will help to stabilize it.
  2403. Contributed by Wojciech Polak.
  2404. ** The grammar file may now specify the name of the parser header file using
  2405. %defines. For example:
  2406. %defines "parser.h"
  2407. ** When reporting useless rules, useless nonterminals, and unused terminals,
  2408. Bison now employs the terms "useless in grammar" instead of "useless",
  2409. "useless in parser" instead of "never reduced", and "unused in grammar"
  2410. instead of "unused".
  2411. ** Unreachable State Removal
  2412. Previously, Bison sometimes generated parser tables containing unreachable
  2413. states. A state can become unreachable during conflict resolution if Bison
  2414. disables a shift action leading to it from a predecessor state. Bison now:
  2415. 1. Removes unreachable states.
  2416. 2. Does not report any conflicts that appeared in unreachable states.
  2417. WARNING: As a result, you may need to update %expect and %expect-rr
  2418. directives in existing grammar files.
  2419. 3. For any rule used only in such states, Bison now reports the rule as
  2420. "useless in parser due to conflicts".
  2421. This feature can be disabled with the following directive:
  2422. %define lr.keep_unreachable_states
  2423. See the %define entry in the "Bison Declaration Summary" in the Bison manual
  2424. for further discussion.
  2425. ** Lookahead Set Correction in the ".output" Report
  2426. When instructed to generate a ".output" file including lookahead sets
  2427. (using "--report=lookahead", for example), Bison now prints each reduction's
  2428. lookahead set only next to the associated state's one item that (1) is
  2429. associated with the same rule as the reduction and (2) has its dot at the end
  2430. of its RHS. Previously, Bison also erroneously printed the lookahead set
  2431. next to all of the state's other items associated with the same rule. This
  2432. bug affected only the ".output" file and not the generated parser source
  2433. code.
  2434. ** --report-file=FILE is a new option to override the default ".output" file
  2435. name.
  2436. ** The "=" that used to be required in the following directives is now
  2437. deprecated:
  2438. %file-prefix "parser"
  2439. %name-prefix "c_"
  2440. %output "parser.c"
  2441. ** An Alternative to "%{...%}" -- "%code QUALIFIER {CODE}"
  2442. Bison 2.3a provided a new set of directives as a more flexible alternative to
  2443. the traditional Yacc prologue blocks. Those have now been consolidated into
  2444. a single %code directive with an optional qualifier field, which identifies
  2445. the purpose of the code and thus the location(s) where Bison should generate
  2446. it:
  2447. 1. "%code {CODE}" replaces "%after-header {CODE}"
  2448. 2. "%code requires {CODE}" replaces "%start-header {CODE}"
  2449. 3. "%code provides {CODE}" replaces "%end-header {CODE}"
  2450. 4. "%code top {CODE}" replaces "%before-header {CODE}"
  2451. See the %code entries in section "Bison Declaration Summary" in the Bison
  2452. manual for a summary of the new functionality. See the new section "Prologue
  2453. Alternatives" for a detailed discussion including the advantages of %code
  2454. over the traditional Yacc prologues.
  2455. The prologue alternatives are experimental. More user feedback will help to
  2456. determine whether they should become permanent features.
  2457. ** Revised warning: unset or unused midrule values
  2458. Since Bison 2.2, Bison has warned about midrule values that are set but not
  2459. used within any of the actions of the parent rule. For example, Bison warns
  2460. about unused $2 in:
  2461. exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
  2462. Now, Bison also warns about midrule values that are used but not set. For
  2463. example, Bison warns about unset $$ in the midrule action in:
  2464. exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
  2465. However, Bison now disables both of these warnings by default since they
  2466. sometimes prove to be false alarms in existing grammars employing the Yacc
  2467. constructs $0 or $-N (where N is some positive integer).
  2468. To enable these warnings, specify the option "--warnings=midrule-values" or
  2469. "-W", which is a synonym for "--warnings=all".
  2470. ** Default %destructor or %printer with "<*>" or "<>"
  2471. Bison now recognizes two separate kinds of default %destructor's and
  2472. %printer's:
  2473. 1. Place "<*>" in a %destructor/%printer symbol list to define a default
  2474. %destructor/%printer for all grammar symbols for which you have formally
  2475. declared semantic type tags.
  2476. 2. Place "<>" in a %destructor/%printer symbol list to define a default
  2477. %destructor/%printer for all grammar symbols without declared semantic
  2478. type tags.
  2479. Bison no longer supports the "%symbol-default" notation from Bison 2.3a.
  2480. "<*>" and "<>" combined achieve the same effect with one exception: Bison no
  2481. longer applies any %destructor to a midrule value if that midrule value is
  2482. not actually ever referenced using either $$ or $n in a semantic action.
  2483. The default %destructor's and %printer's are experimental. More user
  2484. feedback will help to determine whether they should become permanent
  2485. features.
  2486. See the section "Freeing Discarded Symbols" in the Bison manual for further
  2487. details.
  2488. ** %left, %right, and %nonassoc can now declare token numbers. This is required
  2489. by POSIX. However, see the end of section "Operator Precedence" in the Bison
  2490. manual for a caveat concerning the treatment of literal strings.
  2491. ** The nonfunctional --no-parser, -n, and %no-parser options have been
  2492. completely removed from Bison.
  2493. * Noteworthy changes in release 2.3a (2006-09-13)
  2494. ** Instead of %union, you can define and use your own union type
  2495. YYSTYPE if your grammar contains at least one <type> tag.
  2496. Your YYSTYPE need not be a macro; it can be a typedef.
  2497. This change is for compatibility with other Yacc implementations,
  2498. and is required by POSIX.
  2499. ** Locations columns and lines start at 1.
  2500. In accordance with the GNU Coding Standards and Emacs.
  2501. ** You may now declare per-type and default %destructor's and %printer's:
  2502. For example:
  2503. %union { char *string; }
  2504. %token <string> STRING1
  2505. %token <string> STRING2
  2506. %type <string> string1
  2507. %type <string> string2
  2508. %union { char character; }
  2509. %token <character> CHR
  2510. %type <character> chr
  2511. %destructor { free ($$); } %symbol-default
  2512. %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
  2513. %destructor { } <character>
  2514. guarantees that, when the parser discards any user-defined symbol that has a
  2515. semantic type tag other than "<character>", it passes its semantic value to
  2516. "free". However, when the parser discards a "STRING1" or a "string1", it
  2517. also prints its line number to "stdout". It performs only the second
  2518. "%destructor" in this case, so it invokes "free" only once.
  2519. [Although we failed to mention this here in the 2.3a release, the default
  2520. %destructor's and %printer's were experimental, and they were rewritten in
  2521. future versions.]
  2522. ** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with "-y",
  2523. "--yacc", or "%yacc"), Bison no longer generates #define statements for
  2524. associating token numbers with token names. Removing the #define statements
  2525. helps to sanitize the global namespace during preprocessing, but POSIX Yacc
  2526. requires them. Bison still generates an enum for token names in all cases.
  2527. ** Handling of traditional Yacc prologue blocks is now more consistent but
  2528. potentially incompatible with previous releases of Bison.
  2529. As before, you declare prologue blocks in your grammar file with the
  2530. "%{ ... %}" syntax. To generate the pre-prologue, Bison concatenates all
  2531. prologue blocks that you've declared before the first %union. To generate
  2532. the post-prologue, Bison concatenates all prologue blocks that you've
  2533. declared after the first %union.
  2534. Previous releases of Bison inserted the pre-prologue into both the header
  2535. file and the code file in all cases except for LALR(1) parsers in C. In the
  2536. latter case, Bison inserted it only into the code file. For parsers in C++,
  2537. the point of insertion was before any token definitions (which associate
  2538. token numbers with names). For parsers in C, the point of insertion was
  2539. after the token definitions.
  2540. Now, Bison never inserts the pre-prologue into the header file. In the code
  2541. file, it always inserts it before the token definitions.
  2542. ** Bison now provides a more flexible alternative to the traditional Yacc
  2543. prologue blocks: %before-header, %start-header, %end-header, and
  2544. %after-header.
  2545. For example, the following declaration order in the grammar file reflects the
  2546. order in which Bison will output these code blocks. However, you are free to
  2547. declare these code blocks in your grammar file in whatever order is most
  2548. convenient for you:
  2549. %before-header {
  2550. /* Bison treats this block like a pre-prologue block: it inserts it into
  2551. * the code file before the contents of the header file. It does *not*
  2552. * insert it into the header file. This is a good place to put
  2553. * #include's that you want at the top of your code file. A common
  2554. * example is '#include "system.h"'. */
  2555. }
  2556. %start-header {
  2557. /* Bison inserts this block into both the header file and the code file.
  2558. * In both files, the point of insertion is before any Bison-generated
  2559. * token, semantic type, location type, and class definitions. This is a
  2560. * good place to define %union dependencies, for example. */
  2561. }
  2562. %union {
  2563. /* Unlike the traditional Yacc prologue blocks, the output order for the
  2564. * new %*-header blocks is not affected by their declaration position
  2565. * relative to any %union in the grammar file. */
  2566. }
  2567. %end-header {
  2568. /* Bison inserts this block into both the header file and the code file.
  2569. * In both files, the point of insertion is after the Bison-generated
  2570. * definitions. This is a good place to declare or define public
  2571. * functions or data structures that depend on the Bison-generated
  2572. * definitions. */
  2573. }
  2574. %after-header {
  2575. /* Bison treats this block like a post-prologue block: it inserts it into
  2576. * the code file after the contents of the header file. It does *not*
  2577. * insert it into the header file. This is a good place to declare or
  2578. * define internal functions or data structures that depend on the
  2579. * Bison-generated definitions. */
  2580. }
  2581. If you have multiple occurrences of any one of the above declarations, Bison
  2582. will concatenate the contents in declaration order.
  2583. [Although we failed to mention this here in the 2.3a release, the prologue
  2584. alternatives were experimental, and they were rewritten in future versions.]
  2585. ** The option "--report=look-ahead" has been changed to "--report=lookahead".
  2586. The old spelling still works, but is not documented and may be removed
  2587. in a future release.
  2588. * Noteworthy changes in release 2.3 (2006-06-05)
  2589. ** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
  2590. for compatibility with LALR(1) grammars.
  2591. ** It is now documented that any definition of YYSTYPE or YYLTYPE should
  2592. be to a type name that does not contain parentheses or brackets.
  2593. * Noteworthy changes in release 2.2 (2006-05-19)
  2594. ** The distribution terms for all Bison-generated parsers now permit
  2595. using the parsers in nonfree programs. Previously, this permission
  2596. was granted only for Bison-generated LALR(1) parsers in C.
  2597. ** %name-prefix changes the namespace name in C++ outputs.
  2598. ** The C++ parsers export their token_type.
  2599. ** Bison now allows multiple %union declarations, and concatenates
  2600. their contents together.
  2601. ** New warning: unused values
  2602. Right-hand side symbols whose values are not used are reported,
  2603. if the symbols have destructors. For instance:
  2604. exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
  2605. | exp "+" exp
  2606. ;
  2607. will trigger a warning about $$ and $5 in the first rule, and $3 in
  2608. the second ($1 is copied to $$ by the default rule). This example
  2609. most likely contains three errors, and could be rewritten as:
  2610. exp: exp "?" exp ":" exp
  2611. { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
  2612. | exp "+" exp
  2613. { $$ = $1 ? $1 : $3; if ($1) free ($3); }
  2614. ;
  2615. However, if the original actions were really intended, memory leaks
  2616. and all, the warnings can be suppressed by letting Bison believe the
  2617. values are used, e.g.:
  2618. exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
  2619. | exp "+" exp { $$ = $1; (void) $3; }
  2620. ;
  2621. If there are midrule actions, the warning is issued if no action
  2622. uses it. The following triggers no warning: $1 and $3 are used.
  2623. exp: exp { push ($1); } '+' exp { push ($3); sum (); };
  2624. The warning is intended to help catching lost values and memory leaks.
  2625. If a value is ignored, its associated memory typically is not reclaimed.
  2626. ** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
  2627. Destructors are now called when user code invokes YYABORT, YYACCEPT,
  2628. and YYERROR, for all objects on the stack, other than objects
  2629. corresponding to the right-hand side of the current rule.
  2630. ** %expect, %expect-rr
  2631. Incorrect numbers of expected conflicts are now actual errors,
  2632. instead of warnings.
  2633. ** GLR, YACC parsers.
  2634. The %parse-params are available in the destructors (and the
  2635. experimental printers) as per the documentation.
  2636. ** Bison now warns if it finds a stray "$" or "@" in an action.
  2637. ** %require "VERSION"
  2638. This specifies that the grammar file depends on features implemented
  2639. in Bison version VERSION or higher.
  2640. ** lalr1.cc: The token and value types are now class members.
  2641. The tokens were defined as free form enums and cpp macros. YYSTYPE
  2642. was defined as a free form union. They are now class members:
  2643. tokens are enumerations of the "yy::parser::token" struct, and the
  2644. semantic values have the "yy::parser::semantic_type" type.
  2645. If you do not want or can update to this scheme, the directive
  2646. '%define "global_tokens_and_yystype" "1"' triggers the global
  2647. definition of tokens and YYSTYPE. This change is suitable both
  2648. for previous releases of Bison, and this one.
  2649. If you wish to update, then make sure older version of Bison will
  2650. fail using '%require "2.2"'.
  2651. ** DJGPP support added.
  2652. * Noteworthy changes in release 2.1 (2005-09-16)
  2653. ** The C++ lalr1.cc skeleton supports %lex-param.
  2654. ** Bison-generated parsers now support the translation of diagnostics like
  2655. "syntax error" into languages other than English. The default
  2656. language is still English. For details, please see the new
  2657. Internationalization section of the Bison manual. Software
  2658. distributors should also see the new PACKAGING file. Thanks to
  2659. Bruno Haible for this new feature.
  2660. ** Wording in the Bison-generated parsers has been changed slightly to
  2661. simplify translation. In particular, the message "memory exhausted"
  2662. has replaced "parser stack overflow", as the old message was not
  2663. always accurate for modern Bison-generated parsers.
  2664. ** Destructors are now called when the parser aborts, for all symbols left
  2665. behind on the stack. Also, the start symbol is now destroyed after a
  2666. successful parse. In both cases, the behavior was formerly inconsistent.
  2667. ** When generating verbose diagnostics, Bison-generated parsers no longer
  2668. quote the literal strings associated with tokens. For example, for
  2669. a syntax error associated with '%token NUM "number"' they might
  2670. print 'syntax error, unexpected number' instead of 'syntax error,
  2671. unexpected "number"'.
  2672. * Noteworthy changes in release 2.0 (2004-12-25)
  2673. ** Possibly-incompatible changes
  2674. - Bison-generated parsers no longer default to using the alloca function
  2675. (when available) to extend the parser stack, due to widespread
  2676. problems in unchecked stack-overflow detection. You can "#define
  2677. YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read
  2678. the manual to determine safe values for YYMAXDEPTH in that case.
  2679. - Error token location.
  2680. During error recovery, the location of the syntax error is updated
  2681. to cover the whole sequence covered by the error token: it includes
  2682. the shifted symbols thrown away during the first part of the error
  2683. recovery, and the lookahead rejected during the second part.
  2684. - Semicolon changes:
  2685. . Stray semicolons are no longer allowed at the start of a grammar.
  2686. . Semicolons are now required after in-grammar declarations.
  2687. - Unescaped newlines are no longer allowed in character constants or
  2688. string literals. They were never portable, and GCC 3.4.0 has
  2689. dropped support for them. Better diagnostics are now generated if
  2690. forget a closing quote.
  2691. - NUL bytes are no longer allowed in Bison string literals, unfortunately.
  2692. ** New features
  2693. - GLR grammars now support locations.
  2694. - New directive: %initial-action.
  2695. This directive allows the user to run arbitrary code (including
  2696. initializing @$) from yyparse before parsing starts.
  2697. - A new directive "%expect-rr N" specifies the expected number of
  2698. reduce/reduce conflicts in GLR parsers.
  2699. - %token numbers can now be hexadecimal integers, e.g., "%token FOO 0x12d".
  2700. This is a GNU extension.
  2701. - The option "--report=lookahead" was changed to "--report=look-ahead".
  2702. [However, this was changed back after 2.3.]
  2703. - Experimental %destructor support has been added to lalr1.cc.
  2704. - New configure option --disable-yacc, to disable installation of the
  2705. yacc command and -ly library introduced in 1.875 for POSIX conformance.
  2706. ** Bug fixes
  2707. - For now, %expect-count violations are now just warnings, not errors.
  2708. This is for compatibility with Bison 1.75 and earlier (when there are
  2709. reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
  2710. are too many or too few shift/reduce conflicts). However, in future
  2711. versions of Bison we plan to improve the %expect machinery so that
  2712. these violations will become errors again.
  2713. - Within Bison itself, numbers (e.g., goto numbers) are no longer
  2714. arbitrarily limited to 16-bit counts.
  2715. - Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
  2716. * Noteworthy changes in release 1.875 (2003-01-01)
  2717. ** The documentation license has been upgraded to version 1.2
  2718. of the GNU Free Documentation License.
  2719. ** syntax error processing
  2720. - In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
  2721. locations too. This fixes bugs in error-location computation.
  2722. - %destructor
  2723. It is now possible to reclaim the memory associated to symbols
  2724. discarded during error recovery. This feature is still experimental.
  2725. - %error-verbose
  2726. This new directive is preferred over YYERROR_VERBOSE.
  2727. - #defining yyerror to steal internal variables is discouraged.
  2728. It is not guaranteed to work forever.
  2729. ** POSIX conformance
  2730. - Semicolons are once again optional at the end of grammar rules.
  2731. This reverts to the behavior of Bison 1.33 and earlier, and improves
  2732. compatibility with Yacc.
  2733. - "parse error" -> "syntax error"
  2734. Bison now uniformly uses the term "syntax error"; formerly, the code
  2735. and manual sometimes used the term "parse error" instead. POSIX
  2736. requires "syntax error" in diagnostics, and it was thought better to
  2737. be consistent.
  2738. - The documentation now emphasizes that yylex and yyerror must be
  2739. declared before use. C99 requires this.
  2740. - Bison now parses C99 lexical constructs like UCNs and
  2741. backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires.
  2742. - File names are properly escaped in C output. E.g., foo\bar.y is
  2743. output as "foo\\bar.y".
  2744. - Yacc command and library now available
  2745. The Bison distribution now installs a "yacc" command, as POSIX requires.
  2746. Also, Bison now installs a small library liby.a containing
  2747. implementations of Yacc-compatible yyerror and main functions.
  2748. This library is normally not useful, but POSIX requires it.
  2749. - Type clashes now generate warnings, not errors.
  2750. - If the user does not define YYSTYPE as a macro, Bison now declares it
  2751. using typedef instead of defining it as a macro.
  2752. For consistency, YYLTYPE is also declared instead of defined.
  2753. ** Other compatibility issues
  2754. - %union directives can now have a tag before the "{", e.g., the
  2755. directive "%union foo {...}" now generates the C code
  2756. "typedef union foo { ... } YYSTYPE;"; this is for Yacc compatibility.
  2757. The default union tag is "YYSTYPE", for compatibility with Solaris 9 Yacc.
  2758. For consistency, YYLTYPE's struct tag is now "YYLTYPE" not "yyltype".
  2759. This is for compatibility with both Yacc and Bison 1.35.
  2760. - ";" is output before the terminating "}" of an action, for
  2761. compatibility with Bison 1.35.
  2762. - Bison now uses a Yacc-style format for conflict reports, e.g.,
  2763. "conflicts: 2 shift/reduce, 1 reduce/reduce".
  2764. - "yystype" and "yyltype" are now obsolescent macros instead of being
  2765. typedefs or tags; they are no longer documented and are planned to be
  2766. withdrawn in a future release.
  2767. ** GLR parser notes
  2768. - GLR and inline
  2769. Users of Bison have to decide how they handle the portability of the
  2770. C keyword "inline".
  2771. - "parsing stack overflow..." -> "parser stack overflow"
  2772. GLR parsers now report "parser stack overflow" as per the Bison manual.
  2773. ** %parse-param and %lex-param
  2774. The macros YYPARSE_PARAM and YYLEX_PARAM provide a means to pass
  2775. additional context to yyparse and yylex. They suffer from several
  2776. shortcomings:
  2777. - a single argument only can be added,
  2778. - their types are weak (void *),
  2779. - this context is not passed to ancillary functions such as yyerror,
  2780. - only yacc.c parsers support them.
  2781. The new %parse-param/%lex-param directives provide a more precise control.
  2782. For instance:
  2783. %parse-param {int *nastiness}
  2784. %lex-param {int *nastiness}
  2785. %parse-param {int *randomness}
  2786. results in the following signatures:
  2787. int yylex (int *nastiness);
  2788. int yyparse (int *nastiness, int *randomness);
  2789. or, if both %pure-parser and %locations are used:
  2790. int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness);
  2791. int yyparse (int *nastiness, int *randomness);
  2792. ** Bison now warns if it detects conflicting outputs to the same file,
  2793. e.g., it generates a warning for "bison -d -o foo.h foo.y" since
  2794. that command outputs both code and header to foo.h.
  2795. ** #line in output files
  2796. - --no-line works properly.
  2797. ** Bison can no longer be built by a K&R C compiler; it requires C89 or
  2798. later to be built. This change originally took place a few versions
  2799. ago, but nobody noticed until we recently asked someone to try
  2800. building Bison with a K&R C compiler.
  2801. * Noteworthy changes in release 1.75 (2002-10-14)
  2802. ** Bison should now work on 64-bit hosts.
  2803. ** Indonesian translation thanks to Tedi Heriyanto.
  2804. ** GLR parsers
  2805. Fix spurious parse errors.
  2806. ** Pure parsers
  2807. Some people redefine yyerror to steal yyparse' private variables.
  2808. Reenable this trick until an official feature replaces it.
  2809. ** Type Clashes
  2810. In agreement with POSIX and with other Yaccs, leaving a default
  2811. action is valid when $$ is untyped, and $1 typed:
  2812. untyped: ... typed;
  2813. but the converse remains an error:
  2814. typed: ... untyped;
  2815. ** Values of midrule actions
  2816. The following code:
  2817. foo: { ... } { $$ = $1; } ...
  2818. was incorrectly rejected: $1 is defined in the second midrule
  2819. action, and is equal to the $$ of the first midrule action.
  2820. * Noteworthy changes in release 1.50 (2002-10-04)
  2821. ** GLR parsing
  2822. The declaration
  2823. %glr-parser
  2824. causes Bison to produce a Generalized LR (GLR) parser, capable of handling
  2825. almost any context-free grammar, ambiguous or not. The new declarations
  2826. %dprec and %merge on grammar rules allow parse-time resolution of
  2827. ambiguities. Contributed by Paul Hilfinger.
  2828. Unfortunately Bison 1.50 does not work properly on 64-bit hosts
  2829. like the Alpha, so please stick to 32-bit hosts for now.
  2830. ** Output Directory
  2831. When not in Yacc compatibility mode, when the output file was not
  2832. specified, running "bison foo/bar.y" created "foo/bar.c". It
  2833. now creates "bar.c".
  2834. ** Undefined token
  2835. The undefined token was systematically mapped to 2 which prevented
  2836. the use of 2 by the user. This is no longer the case.
  2837. ** Unknown token numbers
  2838. If yylex returned an out of range value, yyparse could die. This is
  2839. no longer the case.
  2840. ** Error token
  2841. According to POSIX, the error token must be 256.
  2842. Bison extends this requirement by making it a preference: *if* the
  2843. user specified that one of her tokens is numbered 256, then error
  2844. will be mapped onto another number.
  2845. ** Verbose error messages
  2846. They no longer report "..., expecting error or..." for states where
  2847. error recovery is possible.
  2848. ** End token
  2849. Defaults to "$end" instead of "$".
  2850. ** Error recovery now conforms to documentation and to POSIX
  2851. When a Bison-generated parser encounters a syntax error, it now pops
  2852. the stack until it finds a state that allows shifting the error
  2853. token. Formerly, it popped the stack until it found a state that
  2854. allowed some non-error action other than a default reduction on the
  2855. error token. The new behavior has long been the documented behavior,
  2856. and has long been required by POSIX. For more details, please see
  2857. Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
  2858. <https://lists.gnu.org/r/bug-bison/2002-05/msg00038.html>.
  2859. ** Traces
  2860. Popped tokens and nonterminals are now reported.
  2861. ** Larger grammars
  2862. Larger grammars are now supported (larger token numbers, larger grammar
  2863. size (= sum of the LHS and RHS lengths), larger LALR tables).
  2864. Formerly, many of these numbers ran afoul of 16-bit limits;
  2865. now these limits are 32 bits on most hosts.
  2866. ** Explicit initial rule
  2867. Bison used to play hacks with the initial rule, which the user does
  2868. not write. It is now explicit, and visible in the reports and
  2869. graphs as rule 0.
  2870. ** Useless rules
  2871. Before, Bison reported the useless rules, but, although not used,
  2872. included them in the parsers. They are now actually removed.
  2873. ** Useless rules, useless nonterminals
  2874. They are now reported, as a warning, with their locations.
  2875. ** Rules never reduced
  2876. Rules that can never be reduced because of conflicts are now
  2877. reported.
  2878. ** Incorrect "Token not used"
  2879. On a grammar such as
  2880. %token useless useful
  2881. %%
  2882. exp: '0' %prec useful;
  2883. where a token was used to set the precedence of the last rule,
  2884. bison reported both "useful" and "useless" as useless tokens.
  2885. ** Revert the C++ namespace changes introduced in 1.31
  2886. as they caused too many portability hassles.
  2887. ** Default locations
  2888. By an accident of design, the default computation of @$ was
  2889. performed after another default computation was performed: @$ = @1.
  2890. The latter is now removed: YYLLOC_DEFAULT is fully responsible of
  2891. the computation of @$.
  2892. ** Token end-of-file
  2893. The token end of file may be specified by the user, in which case,
  2894. the user symbol is used in the reports, the graphs, and the verbose
  2895. error messages instead of "$end", which remains being the default.
  2896. For instance
  2897. %token MYEOF 0
  2898. or
  2899. %token MYEOF 0 "end of file"
  2900. ** Semantic parser
  2901. This old option, which has been broken for ages, is removed.
  2902. ** New translations
  2903. Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
  2904. Croatian, thanks to Denis Lackovic.
  2905. ** Incorrect token definitions
  2906. When given
  2907. %token 'a' "A"
  2908. bison used to output
  2909. #define 'a' 65
  2910. ** Token definitions as enums
  2911. Tokens are output both as the traditional #define's, and, provided
  2912. the compiler supports ANSI C or is a C++ compiler, as enums.
  2913. This lets debuggers display names instead of integers.
  2914. ** Reports
  2915. In addition to --verbose, bison supports --report=THINGS, which
  2916. produces additional information:
  2917. - itemset
  2918. complete the core item sets with their closure
  2919. - lookahead [changed to "look-ahead" in 1.875e through 2.3, but changed back]
  2920. explicitly associate lookahead tokens to items
  2921. - solved
  2922. describe shift/reduce conflicts solving.
  2923. Bison used to systematically output this information on top of
  2924. the report. Solved conflicts are now attached to their states.
  2925. ** Type clashes
  2926. Previous versions don't complain when there is a type clash on
  2927. the default action if the rule has a midrule action, such as in:
  2928. %type <foo> bar
  2929. %%
  2930. bar: '0' {} '0';
  2931. This is fixed.
  2932. ** GNU M4 is now required when using Bison.
  2933. * Noteworthy changes in release 1.35 (2002-03-25)
  2934. ** C Skeleton
  2935. Some projects use Bison's C parser with C++ compilers, and define
  2936. YYSTYPE as a class. The recent adjustment of C parsers for data
  2937. alignment and 64 bit architectures made this impossible.
  2938. Because for the time being no real solution for C++ parser
  2939. generation exists, kludges were implemented in the parser to
  2940. maintain this use. In the future, when Bison has C++ parsers, this
  2941. kludge will be disabled.
  2942. This kludge also addresses some C++ problems when the stack was
  2943. extended.
  2944. * Noteworthy changes in release 1.34 (2002-03-12)
  2945. ** File name clashes are detected
  2946. $ bison foo.y -d -o foo.x
  2947. fatal error: header and parser would both be named "foo.x"
  2948. ** A missing ";" at the end of a rule triggers a warning
  2949. In accordance with POSIX, and in agreement with other
  2950. Yacc implementations, Bison will mandate this semicolon in the near
  2951. future. This eases the implementation of a Bison parser of Bison
  2952. grammars by making this grammar LALR(1) instead of LR(2). To
  2953. facilitate the transition, this release introduces a warning.
  2954. ** Revert the C++ namespace changes introduced in 1.31, as they caused too
  2955. many portability hassles.
  2956. ** DJGPP support added.
  2957. ** Fix test suite portability problems.
  2958. * Noteworthy changes in release 1.33 (2002-02-07)
  2959. ** Fix C++ issues
  2960. Groff could not be compiled for the definition of size_t was lacking
  2961. under some conditions.
  2962. ** Catch invalid @n
  2963. As is done with $n.
  2964. * Noteworthy changes in release 1.32 (2002-01-23)
  2965. ** Fix Yacc output file names
  2966. ** Portability fixes
  2967. ** Italian, Dutch translations
  2968. * Noteworthy changes in release 1.31 (2002-01-14)
  2969. ** Many Bug Fixes
  2970. ** GNU Gettext and %expect
  2971. GNU Gettext asserts 10 s/r conflicts, but there are 7. Now that
  2972. Bison dies on incorrect %expectations, we fear there will be
  2973. too many bug reports for Gettext, so _for the time being_, %expect
  2974. does not trigger an error when the input file is named "plural.y".
  2975. ** Use of alloca in parsers
  2976. If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
  2977. malloc exclusively. Since 1.29, but was not NEWS'ed.
  2978. alloca is used only when compiled with GCC, to avoid portability
  2979. problems as on AIX.
  2980. ** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
  2981. ** When the generated parser lacks debugging code, YYDEBUG is now 0
  2982. (as POSIX requires) instead of being undefined.
  2983. ** User Actions
  2984. Bison has always permitted actions such as { $$ = $1 }: it adds the
  2985. ending semicolon. Now if in Yacc compatibility mode, the semicolon
  2986. is no longer output: one has to write { $$ = $1; }.
  2987. ** Better C++ compliance
  2988. The output parsers try to respect C++ namespaces.
  2989. [This turned out to be a failed experiment, and it was reverted later.]
  2990. ** Reduced Grammars
  2991. Fixed bugs when reporting useless nonterminals.
  2992. ** 64 bit hosts
  2993. The parsers work properly on 64 bit hosts.
  2994. ** Error messages
  2995. Some calls to strerror resulted in scrambled or missing error messages.
  2996. ** %expect
  2997. When the number of shift/reduce conflicts is correct, don't issue
  2998. any warning.
  2999. ** The verbose report includes the rule line numbers.
  3000. ** Rule line numbers are fixed in traces.
  3001. ** Swedish translation
  3002. ** Parse errors
  3003. Verbose parse error messages from the parsers are better looking.
  3004. Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
  3005. Now: parse error: unexpected '/', expecting "number" or '-' or '('
  3006. ** Fixed parser memory leaks.
  3007. When the generated parser was using malloc to extend its stacks, the
  3008. previous allocations were not freed.
  3009. ** Fixed verbose output file.
  3010. Some newlines were missing.
  3011. Some conflicts in state descriptions were missing.
  3012. ** Fixed conflict report.
  3013. Option -v was needed to get the result.
  3014. ** %expect
  3015. Was not used.
  3016. Mismatches are errors, not warnings.
  3017. ** Fixed incorrect processing of some invalid input.
  3018. ** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
  3019. ** Fixed some typos in the documentation.
  3020. ** %token MY_EOF 0 is supported.
  3021. Before, MY_EOF was silently renumbered as 257.
  3022. ** doc/refcard.tex is updated.
  3023. ** %output, %file-prefix, %name-prefix.
  3024. New.
  3025. ** --output
  3026. New, aliasing "--output-file".
  3027. * Noteworthy changes in release 1.30 (2001-10-26)
  3028. ** "--defines" and "--graph" have now an optional argument which is the
  3029. output file name. "-d" and "-g" do not change; they do not take any
  3030. argument.
  3031. ** "%source_extension" and "%header_extension" are removed, failed
  3032. experiment.
  3033. ** Portability fixes.
  3034. * Noteworthy changes in release 1.29 (2001-09-07)
  3035. ** The output file does not define const, as this caused problems when used
  3036. with common autoconfiguration schemes. If you still use ancient compilers
  3037. that lack const, compile with the equivalent of the C compiler option
  3038. "-Dconst=". Autoconf's AC_C_CONST macro provides one way to do this.
  3039. ** Added "-g" and "--graph".
  3040. ** The Bison manual is now distributed under the terms of the GNU FDL.
  3041. ** The input and the output files has automatically a similar extension.
  3042. ** Russian translation added.
  3043. ** NLS support updated; should hopefully be less troublesome.
  3044. ** Added the old Bison reference card.
  3045. ** Added "--locations" and "%locations".
  3046. ** Added "-S" and "--skeleton".
  3047. ** "%raw", "-r", "--raw" is disabled.
  3048. ** Special characters are escaped when output. This solves the problems
  3049. of the #line lines with path names including backslashes.
  3050. ** New directives.
  3051. "%yacc", "%fixed_output_files", "%defines", "%no_parser", "%verbose",
  3052. "%debug", "%source_extension" and "%header_extension".
  3053. ** @$
  3054. Automatic location tracking.
  3055. * Noteworthy changes in release 1.28 (1999-07-06)
  3056. ** Should compile better now with K&R compilers.
  3057. ** Added NLS.
  3058. ** Fixed a problem with escaping the double quote character.
  3059. ** There is now a FAQ.
  3060. * Noteworthy changes in release 1.27
  3061. ** The make rule which prevented bison.simple from being created on
  3062. some systems has been fixed.
  3063. * Noteworthy changes in release 1.26
  3064. ** Bison now uses Automake.
  3065. ** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
  3066. ** Token numbers now start at 257 as previously documented, not 258.
  3067. ** Bison honors the TMPDIR environment variable.
  3068. ** A couple of buffer overruns have been fixed.
  3069. ** Problems when closing files should now be reported.
  3070. ** Generated parsers should now work even on operating systems which do
  3071. not provide alloca().
  3072. * Noteworthy changes in release 1.25 (1995-10-16)
  3073. ** Errors in the input grammar are not fatal; Bison keeps reading
  3074. the grammar file, and reports all the errors found in it.
  3075. ** Tokens can now be specified as multiple-character strings: for
  3076. example, you could use "<=" for a token which looks like <=, instead
  3077. of choosing a name like LESSEQ.
  3078. ** The %token_table declaration says to write a table of tokens (names
  3079. and numbers) into the parser file. The yylex function can use this
  3080. table to recognize multiple-character string tokens, or for other
  3081. purposes.
  3082. ** The %no_lines declaration says not to generate any #line preprocessor
  3083. directives in the parser file.
  3084. ** The %raw declaration says to use internal Bison token numbers, not
  3085. Yacc-compatible token numbers, when token names are defined as macros.
  3086. ** The --no-parser option produces the parser tables without including
  3087. the parser engine; a project can now use its own parser engine.
  3088. The actions go into a separate file called NAME.act, in the form of
  3089. a switch statement body.
  3090. * Noteworthy changes in release 1.23
  3091. The user can define YYPARSE_PARAM as the name of an argument to be
  3092. passed into yyparse. The argument should have type void *. It should
  3093. actually point to an object. Grammar actions can access the variable
  3094. by casting it to the proper pointer type.
  3095. Line numbers in output file corrected.
  3096. * Noteworthy changes in release 1.22
  3097. --help option added.
  3098. * Noteworthy changes in release 1.20
  3099. Output file does not redefine const for C++.
  3100. -----
  3101. LocalWords: yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
  3102. LocalWords: cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
  3103. LocalWords: IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
  3104. LocalWords: destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
  3105. LocalWords: preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
  3106. LocalWords: Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
  3107. LocalWords: yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
  3108. LocalWords: Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
  3109. LocalWords: CHR chr printf stdout namespace preprocessing enum pre include's
  3110. LocalWords: YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
  3111. LocalWords: struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
  3112. LocalWords: YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
  3113. LocalWords: Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
  3114. LocalWords: Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG YY
  3115. LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
  3116. LocalWords: Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
  3117. LocalWords: extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
  3118. LocalWords: lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
  3119. LocalWords: TOK calc yyo fval Wconflicts parsers yystackp yyval yynerrs
  3120. LocalWords: Théophile Ranquet Santet fno fnone stype associativity Tolmer
  3121. LocalWords: Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
  3122. LocalWords: redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
  3123. LocalWords: pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
  3124. LocalWords: Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
  3125. LocalWords: nonterminal yy args Pragma dereference yyformat rhs docdir bw
  3126. LocalWords: Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
  3127. LocalWords: Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE
  3128. LocalWords: XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
  3129. LocalWords: Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
  3130. LocalWords: noexcept constexpr ispell american deprecations backend Teoh
  3131. LocalWords: YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
  3132. LocalWords: fsanitize Vogelsgesang lis redeclared stdint automata yytname
  3133. LocalWords: yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
  3134. LocalWords: symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
  3135. LocalWords: autocompletion bistromathic submessages Cayuela lexcalc hoc
  3136. LocalWords: yytoken YYUNDEF YYerror basename Automake's UTF ifdef ffile
  3137. LocalWords: gotos readline Imbimbo Wcounterexamples Wcex Nonunifying rcex
  3138. Local Variables:
  3139. ispell-dictionary: "american"
  3140. mode: outline
  3141. fill-column: 76
  3142. End:
  3143. Copyright (C) 1995-2015, 2018-2021 Free Software Foundation, Inc.
  3144. This file is part of Bison, the GNU Parser Generator.
  3145. Permission is granted to copy, distribute and/or modify this document
  3146. under the terms of the GNU Free Documentation License, Version 1.3 or
  3147. any later version published by the Free Software Foundation; with no
  3148. Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  3149. Texts. A copy of the license is included in the "GNU Free
  3150. Documentation License" file as part of this distribution.