资源描述:
《flex & bison》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、flex&bisonflex&bisonJohnR.LevineBeijing•Cambridge•Farnham•Köln•Sebastopol•Taipei•Tokyoflex&bisonbyJohnR.LevineCopyright©2009JohnLevine.Allrightsreserved.PrintedintheUnitedStatesofAmerica.PublishedbyO’ReillyMedia,Inc.,1005GravensteinHighwayNorth,Sebastopol,CA95472.O’Rei
2、llybooksmaybepurchasedforeducational,business,orsalespromotionaluse.Onlineeditionsarealsoavailableformosttitles(http://my.safaribooksonline.com).Formoreinformation,contactourcorporate/institutionalsalesdepartment:(800)998-9938orcorporate@oreilly.com.Editor:SimonSt.Laur
3、entIndexer:FredBrownProductionEditor:AdamWitwerCoverDesigner:KarenMontgomeryCopyeditor:KimWimpsettInteriorDesigner:DavidFutatoProofreader:TeresaBerensfeldIllustrator:RobertRomanoProductionServices:MollySharpPrintingHistory:August2009:FirstEdition.NutshellHandbook,theNu
4、tshellHandbooklogo,andtheO’ReillylogoareregisteredtrademarksofO’ReillyMedia,Inc.TheimageofNicobarpigeonsandrelatedtradedressaretrademarksofO’ReillyMedia,Inc.Manyofthedesignationsusedbymanufacturersandsellerstodistinguishtheirproductsareclaimedastrademarks.Wherethosedes
5、ignationsappearinthisbook,andO’ReillyMedia,Inc.wasawareofatrademarkclaim,thedesignationshavebeenprintedincapsorinitialcaps.Whileeveryprecautionhasbeentakeninthepreparationofthisbook,thepublisherandauthorsassumenoresponsibilityforerrorsoromissions,orfordamagesresultingf
6、romtheuseoftheinformationcon-tainedherein.ISBN:978-0-596-15597-1[M]1249406280TableofContentsPreface....................................................................xiii1.IntroducingFlexandBison...............................................1LexicalAnalysisandParsing
7、1RegularExpressionsandScanning2OurFirstFlexProgram2ProgramsinPlainFlex4PuttingFlexandBisonTogether5TheScannerasCoroutine6TokensandValues7GrammarsandParsing9BNFGrammars10Bison’sRuleInputLanguage11CompilingFlexandBisonProgramsTogether13AmbiguousGrammars:NotQuite14Addinga
8、FewMoreRules15FlexandBisonvs.HandwrittenScannersandParsers16Exercises172.UsingFlex...................................