资源描述:
《ndqjava语言词法分析程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、南京大学学报(自然科学)第44卷第2期Vol.44,No.2JOURNALOFNANJINGUNIVERSITY2008年3月Mar.2008(NATURALSCIENCES)*NDQJava语言词法分析程序**徐明君,吴庆曦,宋方敏(南京大学计算机软件新技术国家重点实验室,南京,210093)摘要:随着计算机硬件的发展,电子元件的功能即将受到量子效应的影响.对量子计算和量子计算机的研究迫在眉睫.Shor(JournalofComputing,1994,26:1484~1509)提出的大数质因子分解
2、算法,向人们展示量子计算诱人的潜力.为验证量子算法正确性、通用量子计算机的可行性以及帮助理解量子力学中诸多问题,南京大学量子计算与量子信息研究组于2006年春设计了一种量子程序设计语言NDQJava,并于同年夏在经典计算机上模拟实现了NDQJava的处理系统.此处理系统遵循编译-解释的途径,由词法分析程序、语法分析与代码转换程序、量子汇编与解释程序三部分组成.作为处理系统的第一部分,词法分析程序须将能够正确分析源程序并给出结构明确的单词属性字序列,它的设计实现遵循了简明、易用两条准则.本文着重介绍词法分析程序,较为
3、详细地讨论了其设计与实现过程,并讨论了其主要优缺点.关键词:量子计算,程序设计语言,处理系统,词法分析中图分类号:TP301LexicalanalyzerofNDQJavalanguageXuMingJun,WuQingXi,SongFangMin(StateKeyLaboratoryforNovelSoftwareTechnology,NanjingUniversity,Nanjing,210093,China)Abstract:Withthedevelopmentofcomputerhardware,th
4、efunctionsofelectroniccomponentswillsoonbeaffectedbythequantumeffect.Sotheresearchonquantumcomputingandquantumcomputerstaresusintheface.ThealgorithmfordividingalargeintegerintoprimefactorspresentedbyShor(JournalofComputing,1994,26:1484~1509),showsusthecharmingpot
5、entialofquantumcomputing.Forvalidatingquantumalgorithms,checkingthefeasibilitytobuildauniversalquantumcomputerandhelpingtounderstandmanyproblemsinquantummechanics,theQCI(QuantumComputingandQuantumInformation)GroupofNanjingUniversitydesignedaquantumprogramminglang
6、uage:NDQJavainthespringof2006,andimplementedtheNDQJavaprocessingsystembysimulationontheclassicalcomputerinthesummerofthatyear.Thisprocessingsystemfollowsacompilationinterpretationapproach.ThecompilerofNDQJava,whichincludeslexicalanalyzerandsyntacticanalyzerandco
7、detransformer,compilesNDQJavasourcecodeintoJavaByteCode.ThentheinterpreterofNDQJava,whichincludesquantumassembler,quantuminterpreter,andJavainterpreter,interpretstheJavaByteCodeonruntimeandgives*基金项目:江苏省自然科学基金(BK2007138)收稿日期:2007-06-19**通讯联系人,Email:fmsong@nju.
8、edu.cn第2期徐明君等:NDQJava语言词法分析程序∀117∀therunningresult.AsthefirststepofNDQJavaprocessingsystem,lexicalanalyzermustanalyzetheNDQJavasourceprogramcorrectlyandoutput