Académique Documents
Professionnel Documents
Culture Documents
Bison1.25InvokingBison
Gotothefirst,previous,next,lastsection,tableofcontents.
InvokingBison
TheusualwaytoinvokeBisonisasfollows:
bisoninfile
Hereinfileisthegrammarfilename,whichusuallyendsin`.y'.Theparserfile'snameismadeby
replacingthe`.y'with`.tab.c'.Thus,the`bisonfoo.y'filenameyields`foo.tab.c',andthe`bison
hack/foo.y'filenameyields`hack/foo.tab.c'.
BisonOptions
Bisonsupportsbothtraditionalsingleletteroptionsandmnemoniclongoptionnames.Longoption
namesareindicatedwith`'insteadof`'.Abbreviationsforoptionnamesareallowedaslongasthey
areunique.Whenalongoptiontakesanargument,like`fileprefix',connecttheoptionnameand
theargumentwith`='.
HereisalistofoptionsthatcanbeusedwithBison,alphabetizedbyshortoption.Itisfollowedbya
crosskeyalphabetizedbylongoption.
`bfileprefix'
`fileprefix=prefix'
SpecifyaprefixtouseforallBisonoutputfilenames.Thenamesarechosenasiftheinputfile
werenamed`prefix.c'.
`d'
`defines'
Writeanextraoutputfilecontainingmacrodefinitionsforthetokentypenamesdefinedinthe
grammarandthesemanticvaluetypeYYSTYPE,aswellasafewexternvariabledeclarations.Ifthe
parseroutputfileisnamed`name.c'thenthisfileisnamed`name.h'.Thisoutputfileisessentialif
youwishtoputthedefinitionofyylexinaseparatesourcefile,becauseyylexneedstobeableto
refertotokentypecodesandthevariableyylval.SeesectionSemanticValuesofTokens.
`l'
`nolines'
Don'tputany#linepreprocessorcommandsintheparserfile.OrdinarilyBisonputstheminthe
parserfilesothattheCcompileranddebuggerswillassociateerrorswithyoursourcefile,the
grammarfile.Thisoptioncausesthemtoassociateerrorswiththeparserfile,treatingitasan
independentsourcefileinitsownright.
`n'
`noparser'
DonotincludeanyCcodeintheparserfilegeneratetablesonly.Theparserfilecontainsjust
#definedirectivesandstaticvariabledeclarations.ThisoptionalsotellsBisontowritetheCcode
forthegrammaractionsintoafilenamed`filename.act',intheformofabracesurroundedbody
fitforaswitchstatement.
`ooutfile'
`outputfile=outfile'
Specifythenameoutfilefortheparserfile.Theotheroutputfiles'namesareconstructedfrom
outfileasdescribedunderthe`v'and`d'options.
`pprefix'
http://dinosaur.compilertools.net/bison/bison_12.html#SEC87
1/3
5/11/2016
Bison1.25InvokingBison
`nameprefix=prefix'
Renametheexternalsymbolsusedintheparsersothattheystartwithprefixinsteadof`yy'.The
preciselistofsymbolsrenamedisyyparse,yylex,yyerror,yynerrs,yylval,yycharandyydebug.
Forexample,ifyouuse`pc',thenamesbecomecparse,clex,andsoon.SeesectionMultiple
ParsersintheSameProgram.
`r'
`raw'
Pretendthat%rawwasspecified.SeesectionBisonDeclarationSummary.
`t'
`debug'
OutputadefinitionofthemacroYYDEBUGintotheparserfile,sothatthedebuggingfacilitiesare
compiled.SeesectionDebuggingYourParser.
`v'
`verbose'
Writeanextraoutputfilecontainingverbosedescriptionsoftheparserstatesandwhatisdonefor
eachtypeoflookaheadtokeninthatstate.Thisfilealsodescribesalltheconflicts,boththose
resolvedbyoperatorprecedenceandtheunresolvedones.Thefile'snameismadebyremoving
`.tab.c'or`.c'fromtheparseroutputfilename,andadding`.output'instead.Therefore,ifthe
inputfileis`foo.y',thentheparserfileiscalled`foo.tab.c'bydefault.Asaconsequence,the
verboseoutputfileiscalled`foo.output'.
`V'
`version'
PrinttheversionnumberofBisonandexit.
`h'
`help'
PrintasummaryofthecommandlineoptionstoBisonandexit.
`y'
`yacc'
`fixedoutputfiles'
Equivalentto`oy.tab.c'theparseroutputfileiscalled`y.tab.c',andtheotheroutputsare
called`y.output'and`y.tab.h'.ThepurposeofthisoptionistoimitateYacc'soutputfilename
conventions.Thus,thefollowingshellscriptcansubstituteforYacc:
bisony$*
OptionCrossKey
Hereisalistofoptions,alphabetizedbylongoption,tohelpyoufindthecorrespondingshortoption.
InvokingBisonunderVMS
ThecommandlinesyntaxforBisononVMSisavariantoftheusualBisoncommandsyntaxadaptedto
fitVMSconventions.
TofindtheVMSequivalentforanyBisonoption,startwiththelongoption,andsubstitutea`/'forthe
leading`',andsubstitutea`_'foreach`'inthenameofthelongoption.Forexample,thefollowing
invocationunderVMS:
bison/debug/name_prefix=barfoo.y
isequivalenttothefollowingcommandunderPOSIX.
bisondebugnameprefix=barfoo.y
http://dinosaur.compilertools.net/bison/bison_12.html#SEC87
2/3
5/11/2016
Bison1.25InvokingBison
TheVMSfilesystemdoesnotpermitfilenamessuchas`foo.tab.c'.Intheaboveexample,theoutput
filewouldinsteadbenamed`foo_tab.c'.
Gotothefirst,previous,next,lastsection,tableofcontents.
http://dinosaur.compilertools.net/bison/bison_12.html#SEC87
3/3